Tuesday, October 27, 2009

How to pass TARGETDIR with CustomActionData and not get an Error

Maybe it is just me, but it seems like everything I need to do with an MSI setup is never as easy as it should be. Here is just an other example.

I need to pass the Target Directory for the installation to the InstallClass that I am using in the MSI Custom Actions (I have to do this because of other things in the MSI that don't work like they should). However, when I define the CustomActionData as:

/targetPath=[TARGETDIR]

or

/targetPath="[TARGETDIR]"


I get the following error:

Error 1001. Exception occurred while initializing the Installation:System.IO.FileNotFoundException


The solution I have found is to say this:

/targetPath="[TARGETDIR]\"

I found this info from the following post:

http://www.dotnet247.com/247reference/msgs/35/179584.aspx


I later found the Microsoft documentation on solving the problem:

http://msdn.microsoft.com/en-us/library/2w2fhwzz(VS.71).aspx

2 comments:

Denys Wessels said...

Thanks, you rock!

Moazzam said...

Although its a very old post, But its really save me to hit my head to the wall.

Thanks