Debugging A setup project ? how to debug the 'Custom actions' dll functions ?

S

Sagaert Johan

I have a solution that contains :
-ppc application
-msi setup project
-classlib that contains functions called from the msi setup 'custom actions'
events.

The setup program works, and the functions in the classlib execute normaly.

Now i would like to debug the code in the classlib.
I have set the debug properties of the classlib to 'program' and i have
selected the 'msi setup' output setup.exe as the application to run. However
when i start debugging, the breakpoints i have set in the classlib
(Installer_AfterInstall and
Installer_AfterUnInstall) are never hit. (but the code executes)



How can i debug my classlib ?



Regards

Johan
 
N

Neville Lang

Sagaert,

In the past, I too has the need to debug the methods pointed to from custom
actions. It took a while to research and figure it out but here is how I do
it.

The key to it is that you can start the debugger manually once your full
..NET Framework method has halted. In order to halt you method, you need to
add a temporary MessageBox.Show("whatever"); near the top of your method
that you want to debug. After the Winodws Setup.exe has completed, it checks
if there are any custom actions and if so, it makes the call to your method.
The MessageBox will display and halt processing waiting for user input. At
this point, you need to do the following steps to get the VS. NET 2003
Debugger started to begin debugging your method. Here is a snippet from my
notes:

/// When debugging a call to the Custom Action methods, ensure the
/// MessageBox line is activated in your code. When the Windows
/// Install/Uninstall runs and displays this MessageBox at runtime,
/// do the following:
/// a) Alt-Tab to Visual Studio .NET 2003
/// b) Click on the the Debug menu item
/// c) Click on Processes...
/// d) Locate msiexec.exe with Type .NET and click on it to highlight it
/// e) Click on the Attach button
/// f) Ensure Common Language Runtime is ticked then click on OK
/// g) Check that that msiexec.exe now appears in the list of Debugged
Processes
/// h) Click on the Close button
/// i) Press F9 to set a breakpoint on a line in your method
/// j) Alt-tab back to the MessageBox then click on the OK button to begin
the Debugger
/// It will then stop at your breakpoint ready to step through.

NOTE: Ensure that your method in your DLL has been compiled first in Debug
mode and not Release mode and that the Custom Actions are pointing to the
debug version of your DLL.

I hope this helps you.

Regards,
Neville Lang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top