Debugging Plug ins

Firstly, I’m using Visual Studio 2005. I haven’t done this in any other version so there’s no point in me trying to write about it - please comment if you have and whether these steps differ.
Code needs to be deployed with the debug symbols (.pdb file) which must reside in the same directory as your dll assembly - this necessitates registering the plug-in using the “on disk” method - so my dll and pdb files were saved to Program Files\Microsoft CRM\Server\bin\assembly
To avoid “file in use” errors when copying dlls from my development directory to my development deployment, I added an “iisreset” command into my Post-Build script in Visual Studio, in addition to an xcopy to move the files where i need them.
Since I ran an iisreset, I need to refresh any CRM page after registration to ensure that the w3wp process is available for the debugger to attach to.
Once registered, go back to Visual Studio and select Debug > Attach the Process and then select the w3wp.exe process from the the list
If you haven’t already done so, add some breakpoints to your code in VS by moving the cursor to the code you to break on and press [F9]. A red dot should appear in the margin.
Finally, go to CRM and do whatever is required (as per your plug-in registration) to fire your plug-in (i.e. create/delete/update an appropriate record)
The code should fire and reach your breakpoint in Visual Studio. You can step through the code a line at a time by press [F11] to advance to the next statement.

Comments

Popular posts from this blog

The famous Vanilla story --

Convert fetchXML to SQL Query in MSCRM 4.0

Grid Refresh Failed.