Visual Studio Add-In To Automatically Attach to Development Server

前端 未结 3 1584
星月不相逢
星月不相逢 2020-12-17 23:32

Is anyone aware of a Visual Studio 2010 Add-In that will automatically allow you to attach to a running instance of the ASP.Net Development Server? And if there is more than

相关标签:
3条回答
  • 2020-12-17 23:54

    Check this answer out: Attach To Process in 2012

    This is a simple plugin that gives shortcuts to attaching to nunit agent, IIS and IIS Express. Its pure convenience as compared to Ctrl-Alt-P, but it is convenient.

    Direct link to the plugin here

    0 讨论(0)
  • 2020-12-17 23:59

    I don't know of any such add-in but you can more easily attach to the process using shortcut keys and pressing 'W' to scroll to the WebDev process.

    Ctrl+Alt+P - Attach to Process
    (process window now has focus)
    Press W, which jumps to processes starting with W
    Press Enter to attach

    Not an addin but you can do it without touching the mouse.

    0 讨论(0)
  • 2020-12-18 00:01

    I prefer to do the exact same thing and it IS possible to bind it all to a keystroke with a macro.

    Goto Tools > Macros > Macro IDE

    Add a new module and use this code (the funky comments are for syntax highlighting)

    Imports System
    Imports EnvDTE
    Imports EnvDTE80
    Imports EnvDTE90
    Imports EnvDTE90a
    Imports EnvDTE100
    Imports System.Diagnostics
    Imports System.Collections.Generic
    
    Public Module AttachingModule
        Sub AttachToAspNET()
            Try
                Dim process As EnvDTE.Process
    
                Dim listProcess As New List(Of String)
                '' // uncomment the processes that you'd like to attach to.  I only attach to cassini
                '' // listProcess.Add("aspnet_wp.exe")
                '' // listProcess.Add("w3wp.exe")
                listProcess.Add("webdev.webserver")
    
                For Each process In DTE.Debugger.LocalProcesses
                    For Each procname As String In listProcess
                        If process.Name.ToLower.IndexOf(procname) <> -1 Then
                            process.Attach()
                        End If
                    Next
                Next
    
            Catch ex As System.Exception
                MsgBox(ex.Message)
            End Try
        End Sub
    
    End Module
    

    Click on File > Close and return

    Click on Tools > Options

    Click on Environment > Keyboard

    I put the macro in MyMacros, so I look for "Macros.MyMacros.AttachingModule.AttachToAspNET" in the "Show Commands Containing" textbox".

    I prefer to use Ctrl+Alt+D but put whatever you want in the "Press Shortcut Keys" textbox and click Assign, then OK

    Now all you have to do is hit Ctrl+Alt+D to attach to all cassini instances.

    I've seen various versions of this around the internets and this was the most recent I found. I had to modify that slightly to remove the extra web processes and to drop the .exe from WebDev.WebServer.exe, so that it would debug .net 4.0 instances of cassini.

    0 讨论(0)
提交回复
热议问题