自动连接到开发服务器的 Visual Studio 插件

发布于 2024-12-07 13:30:59 字数 589 浏览 0 评论 0原文

有人知道 Visual Studio 2010 插件可以自动连接到 ASP.Net 开发服务器的运行实例吗?如果当前正在运行多个 ASP.Net 开发服务器,则显示一个快速对话框,让您从正在运行的 ASP.Net 开发服务器列表中进行选择?

我为什么要这个? <-- 随意跳过这一部分。

我通常开发/调试 Web 应用程序的方式是启动浏览器并浏览应用程序,直到到达我想要的页面(可能是很多页面)深。)出于各种原因,我不想通过这些步骤附加调试器(它比不附加它要慢,可能会遇到无关的断点,当“抛出”打开时我可能会中断并且不希望当处理的错误发生时,在应用程序中提前中断抛出等...)

我导航到我想要的页面,然后使用 Visual Studio 菜单“调试”>附加到进程,然后在“附加到进程”对话框中,我必须一直向下滚动(进程的页面和页面),直到找到我想要的 WebDev.WebServer40.EXE 进程并选择它。

这样做会让我的手离开键盘并使用鼠标(我通常会尽量避免这样做。)

并且这样做似乎是不必要的重复,因为如果我正在调试 ASP.Net Web 应用程序,我总是想附加到一个实例WebDev.WebServer40.exe 的。

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 one currently running, display a quick dialog that lets you choose from a list of just the ASP.Net Development Servers that are running?

Why do I want this? <-- feel free to skip this part.

The way I usually develop / debug web applications is to launch a browser and navigate through the application until I get to the page I want (could be many pages deep.) I don't want to have the debugger attached through these steps for various reasons (it is slower than not having it attached, extraneous break-points may be hit, I may have break when "thrown" turned on and not want to break earlier in the app when handled errors are thrown, etc...)

I navigate to the page I want, then use the Visual Studio menus to Debug > Attach to Process, and then from within the Attach to Process dialog, I have to scroll all the way down (pages and pages and pages of processes) until I find the WebDev.WebServer40.EXE process I want and choose that.

Doing this makes me take my hands off the keyboard and use a mouse (something I generally try to avoid.)

And doing this seems needlessly repetitive since, if I am debugging an ASP.Net Web Application, I always want to attach to an instance of the WebDev.WebServer40.exe.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

椒妓 2024-12-14 13:30:59

我更喜欢做完全相同的事情,并且可以可以使用宏将其全部绑定到击键。

转到工具>宏> Macro 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

单击“文件”>“宏 IDE”关闭并返回

点击工具>选项

单击环境>键盘

我将宏放在 MyMacros 中,因此我在“显示包含”文本框的命令”中查找“Macros.MyMacros.AttachingModule.AttachToAspNET”。

我更喜欢使用 Ctrl+Alt+D 但将您想要的任何内容放入“按快捷键”文本框中,然后单击分配,然后单击确定

现在您所要做的就是执行的操作是按 Ctrl+Alt+D 附加到所有 cassini 实例,

我在互联网上看到了各种版本的该实例 。 href="https://stackoverflow.com/questions/2512935/visual-studio-attach-to-prefer-instance-of-the-process-macro">这是最最近我发现,我必须稍微修改一下以删除额外的 Web 进程并从 WebDev.WebServer.exe 中删除 .exe,以便它可以调试 cassini 的 .net 4.0 实例。

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.

太阳哥哥 2024-12-14 13:30:59

我不知道有任何此类插件但是您可以使用快捷键并按“W”滚动到 WebDev 进程更轻松地附加到该进程。

Ctrl+Alt+P - 附加到进程
(流程窗口现在具有焦点)
W,跳转到以 W 开头的进程
Enter 附加

不是插件,但您无需触摸鼠标即可执行此操作。

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.

未央 2024-12-14 13:30:59

看看这个答案:Attach To Process in 2012

这是一个简单的插件,提供了快捷方式连接到 nunit 代理、IIS 和 IIS Express。与 Ctrl-Alt-P 相比,它纯粹是方便,但它很方便。

此处直接链接到插件

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文