views:

306

answers:

1

Install Shield 2009 Premier, Basic MSI Project. Custom Action properties are:

  1. Type: Call a public method in a managed assembly
  2. Location: Stored in the binary table
  3. Specified the class and method name, it shows a message box (so that i'm sure its called) and returns 13 integer value. [didn't choose any Return Property, don't know what to choose]
  4. Return Processing: Synchronous (check exit code)
  5. In-Script Execution: Deferred execution in the system context
  6. Install Execute sequence: After install initialize
  7. Install Execute condition: NOT REMOVE

So during install i get the message box in the public method, but install doesn't exit? How to exit the install from the return type of the custom action(public method of the managed assembly) ?

A: 

Make sure the return type of the function is int or uint (or Int32 or UInt32), and that you are not using a custom signature. With this combination the return value is passed directly to Windows Installer, and values such as 1602, 1603, etc., do what you expect per http://msdn.microsoft.com/en-us/library/aa368072(VS.85).aspx. With either a custom signature or a return property, or a return type other than a simple integer, Windows Installer will always be passed ERROR_SUCCESS. If you don't care exactly what the exit looks like (particularly in the log), throwing an exception will result in ERROR_INSTALL_FAILURE being passed to Windows Installer.

Michael Urman