I recently had a task to write a custom SharePoint web part.
I was able to find couple of very good articles that detail the steps needed for this task.
couple of steps were missed from the articles that I found, specially around how to debug the custom web part within Visual studio.
here are the steps I had to do in order to be able to write and debug the custom web part: (mainly focusing on the debug portion)
- Install “Visual Studio 2008 extensions for Windows SharePoint” from here.
- Create a blank SharePoint site using SharePoint Central Administration page.
- Create a new web part project in Visual studio (once you complete step #1 above, this project type will appear in the list of available projects).
- In the project properties –> Debug –> set the “start browser with URL” to the newly created site in step #2 above. (see image below)
- Read this article and this one to learn more about how to write the code for the custom web part.
- when you have some code ready to be debugged, all is left is to attach the visual studio process to the “w3wp” process from “tools –> Attach to Process…” and refresh the web part page.
- if you need to do remote debugging read this article.
the key steps from the list above that will enable debugging of the custom web part are #2 and #4.
Good Luck
Uri
