Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Debug a custom action dll


1 reply to this topic

kirann_hegde

kirann_hegde
  • Full Members
  • 93 posts

Posted 06 September 2006 - 07:17

Hi All,

1)My msi file has a custom action which calls a function in a dll. I now feel that
there might be some problem with the function which is called by the custom action. The code for the dll has been written in C++. I now want to step through the code in visual studio or visual studio .net when the custom action is being called. The dll is part of the binary table and is not installed with the product. I have been told that it is not possible to step through the code in this case when the dll has not been installed with the product. I

Now assuming that the dll is installed with the product, i want to know the procedure for stepping through the dll code when the msi file is run i.e when the function is called in the installer i.e i need the visual studio or the visual studio.net debugger to popup at the point where i have set the breakpoint.
If someone knows how to do this or if there are any good links on doing this,
please let me know.

Any help would be much appreciated.

Thanks in advance.
--Kiran

Edited by kirann_hegde, 06 September 2006 - 07:17.


kirann_hegde

kirann_hegde
  • Full Members
  • 93 posts

Posted 08 September 2006 - 17:53

Hi,

I found out the procedure to debug a C++ custom action dll after some trial and error. I hope this would help someone trying to do it.

Procedure:
1)Insert a function named "DebugBreak" in your code wherever you wish to break. This function is the equivalent of inserting a break point.
2)Compile the dll in debug mode.
3)Building a dll in debug mode would produce a .pdb file. Copy the .pdb file into the logged in user's temp folder(in case the dll is not installed with the product and is part of the binary table) or alternatively into the install location if the custom action dll is going to be part of the installation.
4)Build the msi file using the debug version of the dll.
5)Run the msi on the system where the .pdb has been copied . Note that this system should have a development environment like visual studio.net or visual studio 6.0 capable of stepping through the code.
6)Once the breakpoint is hit, a popup asks the user if he wants to debug the code.
7)Break into the code and start debugging.

I hope this helps.

Edited by kirann_hegde, 08 September 2006 - 17:54.