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!