Saturday, January 28, 2012

How to stop ASP.NET Development Server after stopping the solution.

When we run the very big solution, asp.net icon is still in system tray even after stopping that solution (ASP.NET Development Server is running behind scene). It is very tedious to close the icon one by one.  Don’t be worry. The way to solve is simple and we have to use macros in Visual Studio.


To create the macros, Open the Visual Studio and go to Tools Menu > Macros > Macros IDE, otherwise use short cut key Alt+F11. You see IDE as below.

Visual Studio Macros IDE
On Visual Studio Macros, go to MyMacros Project > EnvironmentEvent Module and create DebuggerEvents_OnEnterDesignMode event as below.
Private Sub DebuggerEvents_OnEnterDesignMode(ByVal Reason As EnvDTE.dbgEventReason) Handles DebuggerEvents.OnEnterDesignMode
        For Each p In System.Diagnostics.Process.GetProcesses
            If p.ProcessName.IndexOf("WebDev.WebServer40") > -1 Then
                p.Kill()
            End If
        Next
End Sub

That’s is all you have to do. Right now, you don’t need to worry about it. Just mouse over the asp.net icons.:)

1 comment: