Debugging SharePoint web part(SmartTemplate)

After running around in circles for a day, finally figured out how to enable debugging in a SharePoint SmartPart web part project.

When using SharePoint smart part template, the DeploymentTarget is set to “WebApplication” in manifest.xml by default.

  • Modify WSPBuilder.exe.config file adding

    <add key=DeploymentTarget value=GAC />

    Setting the value as GAC (GlobalAssemblyCache) installs the assembly of the custom web part is in C:\WINDOWS\assembly folder automatically.

  • Change the Project Properties: ..\Inetpub\wwwroot\wss\VirtualDirectories\YourSharePointVirtualDirectory\bin\

Changing the output path as mentioned above adds the .dll and .pdb files to the specified web application.

  • Build the solution.
  • Refresh the SharePoint site that has the SmartPart.
  • Debug the solution and attach to process
  • Select the w3wp.exe process.
  • Determine if the selected process is correct by verifying the modules. CTRL + ALT + U will display all the modules. If your module is not listed try another w3wp.exe process.

By following the above steps, we can debug the solution. Once it is ready, change the output path to \bin\debug. Rebuild the solution again.

It is ready to be deployed!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s