views:

804

answers:

3

I need to know the application's ProductCode in the Installer.OnCommitted callback. There doesn't seem to be an obvious way of determining this.

A: 

The MSI function MsiGetProperty can be used to get the name of the ProductCode property. I don't know if that would work in this case, since I've never created a .NET installer.

Chris Tybur
+1  A: 

I ended up passing the product code as a command line argument to my Installer class using the CustomActionData property in Visual Studio (e.g. /productcode={31E1145F-B833-47c6-8C80-A55F306B8A6C}. I can then access this from any callback within the Installer class using the Context.Parameters StringDictionary

string productCode = (string)Context.Parameters["productcode"];
No need to cast to a string, as it's alreay a string
Cocowalla
+1  A: 

You can avoid hardcoding your product code, using /productCode=[ProductCode] in your CustomActionData property.