Debugging SharePoint solutions using Visual Studio

Debugging SharePoint solutions with Visual Studio on local machine is pretty easy. Although you can find articles about how to deploy your PDB files to global assembly cache etc it is more simpler than that. Just follow the steps below. Btw you can click on images if you want to see them on original size.

  1. Compile your solution and deploy it. 
     
  2. Select Tools –> Options from Visual Studio and clear checkbox from “Enable Just My Code (Managed only) checkbox. 
      
    Setting debugging options  
     
  3. Select Tools –> Attach to Process from Visual Studio and select w3wp process you want your debugger to be attached to. 

    Attach debugger to process
    You can detect correct w3wp.exe process using iisapp.vbs script. Check out the following screenshot. 

    Find IIS process for SharePoint  
     

  4. If you want to see what modules are used by process just type CTRL+ALT+U and see if your assemblies are also listed there. 

    Check if your libraries are loaded  
      

  5. Enjoy debugging!

You can set break points in your code and debugger stops code execution at these. So it is like debugging usual ASP.NET applications.


One thought on “Debugging SharePoint solutions using Visual Studio

Leave a Reply

Your email address will not be published. Required fields are marked *