Most of you probably already have figured this out, but for
those of you who still have not, here is how you can debug your web part in
Visual Studio 2010:
- Deploy your Web Part
- Add the Web Part to Page
- In your code, create a break point.
- Go to “Debug” menu, and choose “Attach to Process”.
- Under “Attach to:” section, click on “Select …” button.
- Uncheck all options, checking ONLY “Managed (v2.0, v1.1, v1.0) code”.
- Check the “Show processes in all sessions” checkbox.
- Select all “w3wp.exe” Processes, then click on the “Attach” button.
- Run your page that contains the Web Part. You should now hit your break point, and will be able to step through your code.
This should help speed up your development considerably if
you are not using this method already.
Thanks,
Pete Soheil
3 comments:
Thank You.
--Raghav
My favorite technique: Don't debug SharePoint Web Parts! Build a Windows Console App and do your debugging there instead.
1) Create a windows console app
2) Copy all the relative code from the web part
3) Replace any ASP.NET control output with Console output
4) Debug and step through
5) Copy the fixed code back to the web part.
Cheers!
That will certainly save you quite a bit of time. Thanks for the hint Jonathan.
Post a Comment