ShowUsYour<Blog>

Irregular expressions regularly

Building Msi's is NOT a no-brainer

Having spent the greater part of last week writing a complex .msi installer I was heartened to see a nice listing of Msi tasks which are non-trivial to implement pop-up today:

    http://weblogs.asp.net/astebner/archive/2004/06/06/149713.aspx

Here's some other reading which is interesting if you are venturing into the Msi arena:

A couple of gripes that I have with .msi's... I was disappointed that I couldn't embed totally custom forms into the middle of an installer and that I was unable to programatically interract with CustomActions until the end of the process.  It was also unintuitive as to how I could get the folderpath of where the user was installing the application.  What would have been good was if I could pass the [TARGETDIR] to my custom installation code or at least access it from the saveState hashtable. 

Posted: Jun 07 2004, 02:03 PM by digory | with 6 comment(s)
Filed under: ,

Comments

Justin Rogers said:

You can pass any number of parameters to your custom installer action. I remember passing directory information to the installer we used for the first Terrarium server since we had to specify where to create the database and also where to update the web.config file we just installed.
# June 7, 2004 1:53 AM

Darren Neimke said:

Justin, yes, you can certainly pass any number of params to a custom installer action but, my specific issue is that the [TARGETDIR] environment variable is not available at the time when your custom action code runs.

You should go back and look at how you get the install path... I'd be be interested to know how you did it. In my case I grab the path of the executing assembly which feels like a dirty hack to me.
# June 7, 2004 1:57 AM

David Levine said:

You can pass the TARGETDIR to your custom action by using a param like this...

/TargetDir="[TARGETDIR]\"

I needed to add the trailing backslash but it's been so long ago that I don't recall why.

This will make the value of TARGETDIR available in your custom action using the key of "TargetDir".

string targetDir = this.Context.Parameters["BaseDir"];

It would be convenient if it were available without needing to do it yourself but it's not hard to add it to the data.

# June 7, 2004 4:25 AM

Darren Neimke said:

David, thanks for that. I tried so many combinations for passing TARGETDIR through to the custom action but didn't get the syntax correct. I was expecting the following to work:

/TargetDir=[TARGETDIR]

... but, I'll try your syntax of:

/TargetDir="[TARGETDIR]\"

... tomorrow!

Thanks for the tip :-)
# June 7, 2004 6:02 AM

Stroud said:

This is the third time I've been to your site. Thnx for sharing more details.

# December 29, 2012 3:43 PM