Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the process of debugging ASP.NET Sharepoint applications less time consuming?

I'm comparing it Java where you can start your application server in debug mode, then attach your IDE to the server. And you can change your code "on the fly" without restarting the server. As long as your changes don't affect any method signatures or fields you can just hit recompile for a class and the application server (servlet container) will reload the class.

I suppose this is impossible in ASP.NET since all classes are packed into assemblies and you cannot unload/reload assemblies, can you ?

So when you have an .aspx page and an assembly deployed to GAC and your codebehind changes you have to redeploy the assembly and reset IIS. I'm talking about Sharepoint applications in particular and I'm not sure whether you have to do iisreset for private assemblies but I guess you have too.

So the best way to debug aspx pages with code behind I guess would be to get rid of the codebehind for the time of active debugging and move into the page, then when it is more or less working move it back to codebehind. (This would be applicable only for application pages in Sharepoint, site pages don't allow inline code )

How do you approach debugging of your ASP.NET applications to make it less time consuming?

like image 743
axk Avatar asked Aug 28 '08 09:08

axk


People also ask

How do I debug a SharePoint app?

You can debug SharePoint solutions by using the Visual Studio debugger. When you start debugging, Visual Studio deploys the project files to the SharePoint server and then opens an instance of the SharePoint site in the Web browser.

How is .NET debugging implemented?

ASP.Net has the facility to perform debugging and Error handling. Debugging can be achieved by adding breakpoints to the code. One then runs the Start with Debugging option in Visual Studio to debug the code. Tracing is the facility to provide more information while running the application.


1 Answers

From Matt Smiths blog on how to get F5 debugging with sharepoint. A very cool trick.

  1. Create a web application project in Visual Studio (File -> New -> Project -> ASP.Net Web Application, not File -> New -> Web Site).
  2. Move the .csproj and .csproj.user files, along with the Properties folder, into C:\inetpub\wwwroot\wss\virtualdirectories\, where is the name or number of the web application corresponding to the SharePoint site you'd like to debug on.
  3. Attach the project to an existing solution (e.g. STSDEV project).
  4. Set as startup project (right-click project name, "Set as Startup Project").
  5. Access project properties (right-click project name, "Properties") and click
  6. Under the "Servers" setting, click "Use IIS web server", then enter the URL to the SharePoint web application you want to debug on, e.g. http://mymachine:99.
like image 157
Nat Avatar answered Sep 28 '22 03:09

Nat