views:

477

answers:

1

Hello Gentlemen!

I have an exercise for you ! :)

I need to get an [INSTALLDIR] MSI property in my Installer class implemented in C#. Using InstallShield 2010, I created a component with a .NET assembly defined as key file of the component. Specified that the component is a .NET Installer Class, implemented required interface and made sure it was called during execution flow. Now I need to get installation directory MSI property. Do you guys have any ideas?

I know there is a predefined custom action to pass properties to deferred custom actions but I don't actually have an custom action for running Installer class, this is an installation component. There are some samples for Visual Studio installers, but install shield seems to be little different.

Thanks much!

A: 

In InstallShield | Component Properties, right below where you said .NET Installer Class = Yes you put in your .NET Installer Class Arguments. You basically do something like

/INSTALLDIR="[INSTALLDIR]\" /FOO=42

Inside your context you can then access INSTALLDIR and FOO.

But I'd like to be really honest with you: You don't want to do this. Take it from me, WiX C# DTF is a much better pattern that eliminates many issues with InstallUtil that you will eventually encounter and regret.

I have DTF examples on my blog. Just search for DTF.

Christopher Painter
Chris, thanks much! This approach works so far, but I will definitely read about WiX C# DTF. What problems you think might occure when passing parameters to .NET installer class?
http://robmensching.com/blog/posts/2007/4/19/Managed-Code-CustomActions-no-support-on-the-way-and-heresBasically severa things are bad about InstallUtil that is better in DTF1) When it fails, you get mysterious 1001 popups; even in silent mode.2) It doesn't have access to the MSI handle so it can't set MSI properties or write to the MSI log.3) The first CLR version jitted is stickey. If a 1.1 CA fires then a 2.0 CA fires you get an exception.
Christopher Painter