Debugging Custom Actions in Windows Installer
Photo by Jan van der Wolf on Pexels
In Visual Studio, you can add Setup Projects and WiX projects. Especially WiX projects are very powerful. Unfortunately, you cannot run the generated Msi-Package in debug mode to be able to step into your own custom actions. Well, the solution is simple: just add a call to the Debugger.Launch method wherever you want to step into your code. Example:
[CustomAction]
public static ActionResult MyCustomAction(Session session)
{
// Start debugging here:
System.Diagnostics.Debugger.Launch();
session.Log("Begin CustomAction");
// Actual action here...
session.Log("End CustomAction");
return ActionResult.Success;
}
Now, when the Msi-package is executed normally, the debugger will launch as soon as the custom action is called. At hat point, the Visual Studio Just-In-Time Debugger will pop up.
Category: Windows Installer and Deployment