我更喜欢做完全相同的事情,并且可以将其全部绑定到使用宏的击键上。
转到工具 > 宏 > 宏 IDE
添加一个新模块并使用此代码(时髦的注释用于语法突出显示)
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
单击文件>关闭并返回
单击工具>选项
单击环境>键盘
我将宏放在 MyMacros 中,因此我在“显示包含的命令”文本框中查找“Macros.MyMacros.AttachingModule.AttachToAspNET”。
我更喜欢使用Ctrl++ Alt,D但在“Press Shortcut Keys”文本框中输入你想要的任何内容,然后单击Assign,然后OK
现在您所要做的就是点击Ctrl++以附加到所有AltcassiniD实例。
我在互联网上看到过各种版本,这是我发现的最新版本。我不得不稍微修改它以删除额外的 Web 进程并从 .exe 中删除 .exe WebDev.WebServer.exe
,以便它可以调试 .net 4.0 的 cassini 实例。