Google Groups
Subscribe to Software Outsourcing [ Hire Dedicated Group ]
Email:
Visit this group

Thursday, April 10, 2008

How to Debug a Web Part for SharePoint 2007

The basic steps are as follows:
  1. Open the solution with the web part(s).
  2. Now goto Project ---> Properties --> Click on Debug ---> Set Start browser with URL to your share point site url e.g. http://sharepoint:80
  3. Now Build the project. So it creates .dll and .pdb files in bin directory.
  4. Now copy those both files into C:\Inetpub\wwwroot\wss\VirtualDirectories\ ( Your website)\bin directory.
  5. Now deploy your web part project. Import the web part into the web part gallery so it is visbile, create a smaple page and add the web part to the page in design view and publish the page.
  6. Now place a break point on the code of interest in Visual Studio.
  7. Under the Debug Menu, select Attach to Process
  8. Find the w3wp.exe process. If none exists, begin browsing to the site that has the web part you are debugging. (I usually conduct an IIS reset so that all of the w3wp.exe processes go away and the sole one that you are interested in is easier to find)
  9. Watch as the page processes and as soon as your web part is hit, Visual Studio will load symbols and begin the debugging process
  10. Enjoy....