harriyott.com

16 February 2007

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:

public override void Install(IDictionary stateSaver)
{
  Debugger.Break();
  ...


This will launch the following popup; choose Debug:

Debugger message

Then choose the debugger with your installer project loaded:

Debugger message

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:

Anonymous Anonymous said...

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.

Blogger Stone Cold said...

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?

Anonymous Anonymous said...

Thanks for the tip.

Post a Comment