Dennis van der Stelt asked me how to debug CSModules without using the Community Server SDK. Ok, so here’s how I debug my modules.
First I set the output directory of my projects to CS’ bin folder. To debug the module, I attach the debugger manually to ASP.NET worker process, aspnet_wp.exe. However, that’s not very ergonomic, because you have to go to Debug → Attach To Process, select aspnet_wp.exe (fortunately, processes are sorted by their name) and click OK.
However, after a while that gets really annoying.
Therefore I searched for a simpler solution, e.g. an add-in. I stumbled over this nice and short macro, published by Roy Osherove (who else? [;)]):
This was on the win-tech-off-topic mailing list:
A macro to automatically attach to aspnet_wp.exe, written by Kevin Dente can save lots of clicking around time:
Sub AttachAspNet() Dim process As EnvDTE.Process If Not (DTE.Debugger.DebuggedProcesses Is Nothing) Then For Each process In DTE.Debugger.DebuggedProcesses If (process.Name.IndexOf("aspnet\_wp.exe") \<\> -1) Then Exit Sub End If Next End If For Each process In DTE.Debugger.LocalProcesses If (process.Name.IndexOf("aspnet\_wp.exe") \<\> -1) Then process.Attach() Exit Sub End If Next End Sub
Unfortunately, it’s not perfect. Process.Attach doesn’t let you specify the program type (CLR, Script, native, etc). I think that it uses whatever your last selection was in the UI. But don’t quote me on that, it’s been a while.
I added the macro to a toolbar, so debugging my modules is only one click far. [:)]
Leave a Comment
Your email address will not be published. Required fields are marked *