Debugging Custom Actions in Visual Studio Installer
When writing an installer in Visual Studio 2005, you can't debug the custom actions by starting the debugger by pressing F5 in the usual way. One way is to start the installer and attach to the process when the files have been installed, but you may miss the earliest actions. The way to get the debugger to break at the beginning of the custom action code is to add a breakpoint into the code:
This will launch the following popup; choose Debug:

Then choose the debugger with your installer project loaded:

This will put Visual Studio in debug mode, at the breakpoint in your custom action code. You can step through it and see what it's doing.
public override void Install(IDictionary stateSaver)
{
Debugger.Break();
...This will launch the following popup; choose Debug:

Then choose the debugger with your installer project loaded:

This will put Visual Studio in debug mode, at the breakpoint in your custom action code. You can step through it and see what it's doing.
3 Comments:
If you want to use your currently running instance of Visual Studio as the debugger, it must be running as administrator. Otherwise, it will not show up in the list of possible debuggers.
I am doing the same thing. But when debugger opens, it gives error message "Unable to attache the crashing process. Access denied"
I can't figure out, what is the problem. I had already logged with administrator user.
Any idea?
Thanks for the tip.
Post a Comment