PDA

View Full Version : Get/Set msi properties in a CA



DMason
01-12-2005, 12:36 PM
I have read in other posts about getting/setting msi properties from within a VBScript custom action. For example:
Session.Property("PROPERTY_NAME") = strPropertyValue

Is there a way for a .NET executable (launched as a CA) to get/set msi properties?

Christopher Painter
01-12-2005, 01:00 PM
I'm not a .NET Developer, but I know in VB6 I've made ActiveX classes that I pass the session object by reference.

DMason
01-12-2005, 01:21 PM
Is the Session object an InstallShield object, Windows Installer object, or other?

When you referenced the Session object in Visual Studio 6, did you use late binding, or did you set a reference to a particular dll?
(If a dll reference was used, what dll?)

Christopher Painter
01-12-2005, 01:35 PM
http://msdn.microsoft.com/library/en-us/msi/setup/installer_object.asp

http://msdn.microsoft.com/library/en-us/msi/setup/session_object.asp

I use late binding to make sure I avoid runtime compatibility problems between different versions of msi.dll. The MSI SDK has an automation interface aswell as a Win32 API. Depending on your programing environment you either make use of the MSI handle or the session object. I know if I made a VBScript CA ( yuck ) that the session object exists and I can pass it to another program. If I call a EXE custom action I know that I can create a new instance of the Installer object but I have never tried to get a reference to an existing one. Also a DOS EXE could be passed a handle to the installer object and from there you could use the Win32API to hit the properties that way.

A thorough reading of the MSI SDK would be very helpful.