Invoking managed actions that are in another class.

May 9, 2015 at 10:22 PM
Edited May 9, 2015 at 10:23 PM
I created a public static class to keep all my EventLogInstaller actions separate from setup.cs. Then I tried referencing it, using both of these methods.
new ElevatedManagedAction("InitializeServerEventLog", Return.check, When.Before, Step.InstallFinalize, installServer),
new ElevatedManagedAction("EventLogInstaller.InitializeClientEventLog", Return.check, When.Before, Step.InstallFinalize, installClient),
Wix built an msi happily, however they would both cause an exception during installation like:
There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor.  Action Action4_EventLogInstaller.InitializeClientEventLog, entry: EventLogInstaller.InitializeClientEventLog, library: C:\WINDOWS\Installer\MSI7D09.tmp 
If I move the methods to the Setup.cs:Script.Main method it works fine.

In your docs it says:
Managed CustomAction can be defined either in the Wix# script or in the external assembly or C# file. The only requirements for any C# method to be qualified for being Managed CustomAcyion is to have DTF Action signature public static ActionResult MyManagedAction(Session session), and be marked with [CustomAction] attribute. ` which I believe have done.
What am I doing wrong?
May 9, 2015 at 10:38 PM
Interesting, I made the script and my external class both public static partial class Script, and msiexec still gives me the same error. They need to be in the same file to work. Bug?
May 9, 2015 at 11:49 PM
I upgraded to and this problem went away. I think the assembly resolution code that you added did the trick.

Marked as answer by TwoRedCells on 5/9/2015 at 3:49 PM