如何在没有Visual Studio的机器上设置远程调试

时间:2022-10-15 22:35:13

Is there a way to setup Remote Debugging (Msvscom.exe) on a machine that does not have Visual Studio installed?

是否有办法在没有安装Visual Studio的机器上设置远程调试(Msvscom.exe) ?

I would like to attach to the service running on the VM so I can debug an issue in the code. I've done this before but both machines have had VS installed.

我想要附加到运行在VM上的服务,这样我就可以调试代码中的一个问题了。我以前做过,但是这两台机器都安装了VS。

The Dev box is running Visual Studio 2010/Widnows 7. The VM is running Windows 7 without Visual Studio.

开发框正在运行Visual Studio 2010/Widnows 7。VM运行的是没有Visual Studio的Windows 7。

4 个解决方案

#1


85  

I'm going to resurrect this because anyone who's tried to do this knows it's a complete pain in the ass every time, and that it changes slightly with every possible combination of host/remote system you can have.

我要重新说一遍因为任何尝试过的人都知道每次都是非常痛苦的,而且随着主机/远程系统的各种可能组合,它会有轻微的变化。

Visual Studio Remote Tools Links:

  1. Visual Studio 2010 remote debugger. (Working as of 21/Oct/2016)
  2. Visual Studio 2010远程调试器。(工作截至2016年/ 10月21日)
  3. Visual Studio 2013 remote tools (working as of 21/Oct/2016)
  4. Visual Studio 2013 remote tools(截至2016年10月21日工作)
  5. Visual Studio 2015 remote tools x86 - Direct download link
  6. Visual Studio 2015远程工具x86 -直接下载链接
  7. Visual Studio 2015 remote tools x64 - Direct download link
  8. Visual Studio 2015 remote tools x64 - Direct download link
  9. Visual Studio Tools (Thanks Robo Burned)
  10. Visual Studio工具(感谢Robo烧伤)

This is the setup I succeeded with today:

这是我今天成功的设置:

Host (Dev) Machine:
Windows 7 Ultimate SP1 x64. Running Visual Studio 2010, .NET Framework 4.

主机(Dev): Windows 7终极SP1 x64。运行Visual Studio 2010,。net Framework 4。

Remote Machine:
Industrial/Factory Floor PC running Windows Embedded Standard 32-bit. It looks/feels exactly like Windows 7. Running SP1. Visual Studio is not installed. Has the .NET framework 4.

远程机器:工业/工厂地板PC运行Windows嵌入式32位标准。它看起来和Windows 7完全一样。运行SP1。没有安装Visual Studio。拥有。net框架4。

Network:
Both machines are on the same subnet. I access the remote machine via RDP and run my application that way.

网络:两台机器在同一个子网上。我通过RDP访问远程机器并以这种方式运行应用程序。

Microsoft-Proprietary Follicle-Deterioration Implementation:
Make note of your dev machine's user name and password. For some reason you have to create exactly the same user name and password on the remote machine. Because Microsoft.

microsoft专有的滤泡恶化实现:注意开发机器的用户名和密码。出于某种原因,您必须在远程计算机上创建完全相同的用户名和密码。因为微软。

How I did it:
I downloaded the Visual Studio 2010 remote debugger from the link provided by @sJhonny. I had to switch off of Visual Studio 2013 in that article and over to 2010. If you care to go over the 2010 article with a fine-tooth comb to find the download, the link is right next to the "No one ever finds this helpful" link at the top. If not, just follow my link above.

方法:我从@sJhonny提供的链接下载了Visual Studio 2010远程调试器。在那篇文章中,我不得不关掉Visual Studio 2013,转到2010年。如果你想仔细阅读2010年的文章,找到下载,链接就在“没人能找到这个有用的”链接的旁边。如果没有,请点击上面的链接。

Install that on the remote machine and run the configuration wizard. I left the defaults for the wizard:

在远程机器上安装并运行配置向导。我保留了向导的默认值:

  • "Run the 'Visual Studio ....." was checked off
  • “运行‘Visual Studio…’”被检查完毕
  • Username is LocalSystem and password is blank
  • 用户名是LocalSystem,密码是空的
  • Allow only computers on the local network....
  • 只允许在本地网络上的电脑....

Run the Remote Debugger on the remote system and you'll see

在远程系统上运行远程调试器,您将看到

Msvsmon started a new server named 'username@machinename...'

Msvsmon启动了一个名为“username@machinename…”的新服务器。

in the interface. So far so good. Run the application on the remote machine. On the dev machine, Ctrl+Alt+P in visual studio will open "Attach to Process" (It's also under the tools menu). I got a popup about my dev machine's firewall not being configured properly and was asked if I wanted to allow the connections etc... Say yes obviously.

的接口。目前为止一切都很顺利。在远程机器上运行应用程序。在开发机器上,visual studio中的Ctrl+Alt+P将打开“Attach to Process”(它也在tools菜单下)。我有一个关于我的开发机器的防火墙配置不正确的弹出窗口,有人问我是否要允许连接等等……说是很明显。

Enter the 'username@machinename' combination into the qualifier box... press Refresh and pray a little. Pray a little more a lot harder and you should see a list of the processes running on the remote machine. Select your process and attach to it.

在限定符框中输入'username@machinename'组合…按一下刷新,祈祷一下。再努力一点,你会看到在远程机器上运行的进程列表。选择您的进程并附加到它。

But my breakpoints don't work!? Of course they don't... because using the breakpoints in the same directory as the application on the remote machine would make too much sense. If you were lucky enough, you got warned about a breakpoint cache and got shown a dialog with a path.

但是我的断点不管用!?当然他们不…因为在与远程机器上的应用程序相同的目录中使用断点会有很大的意义。如果你够幸运的话,你会得到一个断点缓存的警告,并显示了一个路径的对话框。

The dialog mentions something about it being correct relative to the remote machine. It's lying. It has nothing to do with the remote machine except that it forced you to create a brand new user over there with the same name as your current user because Microsoft. To get your breakpoints to work, follow the path on your dev machine (customizable in Tools>Options>Debugging>Symbols: Cache symbols in this directory) and copy your application's .pdb files over to that directory. You have to copy them over with every new build, unless there's an option to do it automatically; I haven't checked because I have yet to stop celebrating my remote debugging success.

对话框中提到相对于远程机器来说,它是正确的。这是在撒谎。它与远程机器没有任何关系,只是迫使您在那里创建一个与当前用户同名的全新用户,因为Microsoft。要让断点正常工作,请遵循开发机器上的路径(在工具>中可定制的选项>调试>符号:在此目录中的缓存符号),并将应用程序的.pdb文件复制到该目录。你必须在每一个新版本中复制它们,除非有自动执行的选项;我还没有检查,因为我还没有停止庆祝我的远程调试成功。

Everything should work now.

现在应该工作的一切。

I hope that helps someone save the hours of blinding rage I've endured trying to get this to work on different machines over the years.

我希望这能帮助某人避免多年来我一直忍受的在不同的机器上工作时的那种盲目的愤怒。

#2


16  

certainly there is.
You can install msvsmon without installing visual studio.
I've done this myself on several machines.
the tricky part lays in authorization- the user running VS on your local machine needs special priviliges on the remote machine.
ms has some articles explaining the details- http://msdn.microsoft.com/en-us/library/bt727f1t.aspx,

当然有。您可以安装msvsmon而无需安装visual studio。我自己用过好几台机器。棘手的部分在于授权——在本地机器上运行VS的用户需要远程机器上的特殊特权。ms有一些解释细节的文章——http://msdn.microsoft.com/en-us/library/bt727f1t.aspx,

#3


4  

Update: Here's the links for 2017 which are not obvious to find either.

更新:这是2017年的链接,也不是很明显。

Visual Studio Remote Tools Links x64 direct link

Visual Studio远程工具链接x64直接链接

Visual Studio Remote Tools Links x86 direct link

Visual Studio远程工具链接x86直接链接

#4


1  

Taken from: how-to-implement-remote-debugging-in-visual-studio-2005

来自:-实施-远程-调试- 2005年-视觉工作室

Let's consider an example to understand this situation clearly. Molly Clark and Adam Barr are both employees at Adventure Works. Adventure Works has a Microsoft Windows NT domain named adventure-works.com. Adam is having trouble with some software that Molly wrote. Molly would like to debug this software on Adam's computer. Molly and Adam follow these steps:

让我们考虑一个例子来清楚地理解这种情况。莫莉·克拉克和亚当·巴尔都是探险公司的员工。Adventure Works拥有一个名为ad风投-works.com的微软Windows NT域名。亚当在莫莉写的软件上遇到了麻烦。莫莉想在亚当的电脑上调试这个软件。莫莉和亚当遵循以下步骤:

  • Adam doesn't have the remote debugger on his computer. To set up the remote debugger, Molly decides to share out the Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger directory on her computer. She creates a file share called Remote.
  • 亚当的电脑上没有远程调试器。为了设置远程调试器,莫莉决定在她的电脑上分享程序文件,微软Visual Studio 8\Common7\IDE\远程调试器目录。她创建了一个名为Remote的文件共享。
  • Adam runs \MollyComputerName\Remote\x86\Msvsmon.exe.
  • 亚当运行远程\ x86 \ Msvsmon.exe \ MollyComputerName \。
  • After the remote debugger starts, Adam clicks Permissions on the Tools menu to configure the remote debugger by using the Permissions dialog box. He gives Molly permission to debug.
    Note Adam could also configure the remote debugger by passing the /allow option when the remote debugger starts.
  • 在远程调试器启动之后,Adam通过使用“权限”对话框单击“工具”菜单上的“权限”来配置远程调试器。他允许莫莉调试。注意,Adam还可以通过在远程调试器启动时传递/allow选项来配置远程调试器。
  • Molly starts Visual Studio 2005.
  • 莫莉开始了Visual Studio 2005。
  • To open the Attach to Process dialog box, Molly clicks Attach to Process on the Tools menu.
  • 要打开“附加到进程”对话框,莫莉在“工具”菜单上单击“附加到进程”。
  • Molly connects to Adam's computer by entering adventure-works.com\Adam@AdamComputerName in the Qualifier box.
  • 莫莉通过在限定符框中输入adrisk -works.com\Adam@AdamComputerName连接到亚当的电脑。
  • Under Available Processes, Molly selects the worker process that her application is using and then clicks Attach.
  • 在可用进程中,莫莉选择应用程序正在使用的worker进程,然后单击Attach。
  • Molly opens a browser and provides the URL to the remote application. The execution stops where the breakpoint is placed in the application.
  • Molly打开一个浏览器并提供到远程应用程序的URL。执行停止在应用程序中放置断点的地方。

#1


85  

I'm going to resurrect this because anyone who's tried to do this knows it's a complete pain in the ass every time, and that it changes slightly with every possible combination of host/remote system you can have.

我要重新说一遍因为任何尝试过的人都知道每次都是非常痛苦的,而且随着主机/远程系统的各种可能组合,它会有轻微的变化。

Visual Studio Remote Tools Links:

  1. Visual Studio 2010 remote debugger. (Working as of 21/Oct/2016)
  2. Visual Studio 2010远程调试器。(工作截至2016年/ 10月21日)
  3. Visual Studio 2013 remote tools (working as of 21/Oct/2016)
  4. Visual Studio 2013 remote tools(截至2016年10月21日工作)
  5. Visual Studio 2015 remote tools x86 - Direct download link
  6. Visual Studio 2015远程工具x86 -直接下载链接
  7. Visual Studio 2015 remote tools x64 - Direct download link
  8. Visual Studio 2015 remote tools x64 - Direct download link
  9. Visual Studio Tools (Thanks Robo Burned)
  10. Visual Studio工具(感谢Robo烧伤)

This is the setup I succeeded with today:

这是我今天成功的设置:

Host (Dev) Machine:
Windows 7 Ultimate SP1 x64. Running Visual Studio 2010, .NET Framework 4.

主机(Dev): Windows 7终极SP1 x64。运行Visual Studio 2010,。net Framework 4。

Remote Machine:
Industrial/Factory Floor PC running Windows Embedded Standard 32-bit. It looks/feels exactly like Windows 7. Running SP1. Visual Studio is not installed. Has the .NET framework 4.

远程机器:工业/工厂地板PC运行Windows嵌入式32位标准。它看起来和Windows 7完全一样。运行SP1。没有安装Visual Studio。拥有。net框架4。

Network:
Both machines are on the same subnet. I access the remote machine via RDP and run my application that way.

网络:两台机器在同一个子网上。我通过RDP访问远程机器并以这种方式运行应用程序。

Microsoft-Proprietary Follicle-Deterioration Implementation:
Make note of your dev machine's user name and password. For some reason you have to create exactly the same user name and password on the remote machine. Because Microsoft.

microsoft专有的滤泡恶化实现:注意开发机器的用户名和密码。出于某种原因,您必须在远程计算机上创建完全相同的用户名和密码。因为微软。

How I did it:
I downloaded the Visual Studio 2010 remote debugger from the link provided by @sJhonny. I had to switch off of Visual Studio 2013 in that article and over to 2010. If you care to go over the 2010 article with a fine-tooth comb to find the download, the link is right next to the "No one ever finds this helpful" link at the top. If not, just follow my link above.

方法:我从@sJhonny提供的链接下载了Visual Studio 2010远程调试器。在那篇文章中,我不得不关掉Visual Studio 2013,转到2010年。如果你想仔细阅读2010年的文章,找到下载,链接就在“没人能找到这个有用的”链接的旁边。如果没有,请点击上面的链接。

Install that on the remote machine and run the configuration wizard. I left the defaults for the wizard:

在远程机器上安装并运行配置向导。我保留了向导的默认值:

  • "Run the 'Visual Studio ....." was checked off
  • “运行‘Visual Studio…’”被检查完毕
  • Username is LocalSystem and password is blank
  • 用户名是LocalSystem,密码是空的
  • Allow only computers on the local network....
  • 只允许在本地网络上的电脑....

Run the Remote Debugger on the remote system and you'll see

在远程系统上运行远程调试器,您将看到

Msvsmon started a new server named 'username@machinename...'

Msvsmon启动了一个名为“username@machinename…”的新服务器。

in the interface. So far so good. Run the application on the remote machine. On the dev machine, Ctrl+Alt+P in visual studio will open "Attach to Process" (It's also under the tools menu). I got a popup about my dev machine's firewall not being configured properly and was asked if I wanted to allow the connections etc... Say yes obviously.

的接口。目前为止一切都很顺利。在远程机器上运行应用程序。在开发机器上,visual studio中的Ctrl+Alt+P将打开“Attach to Process”(它也在tools菜单下)。我有一个关于我的开发机器的防火墙配置不正确的弹出窗口,有人问我是否要允许连接等等……说是很明显。

Enter the 'username@machinename' combination into the qualifier box... press Refresh and pray a little. Pray a little more a lot harder and you should see a list of the processes running on the remote machine. Select your process and attach to it.

在限定符框中输入'username@machinename'组合…按一下刷新,祈祷一下。再努力一点,你会看到在远程机器上运行的进程列表。选择您的进程并附加到它。

But my breakpoints don't work!? Of course they don't... because using the breakpoints in the same directory as the application on the remote machine would make too much sense. If you were lucky enough, you got warned about a breakpoint cache and got shown a dialog with a path.

但是我的断点不管用!?当然他们不…因为在与远程机器上的应用程序相同的目录中使用断点会有很大的意义。如果你够幸运的话,你会得到一个断点缓存的警告,并显示了一个路径的对话框。

The dialog mentions something about it being correct relative to the remote machine. It's lying. It has nothing to do with the remote machine except that it forced you to create a brand new user over there with the same name as your current user because Microsoft. To get your breakpoints to work, follow the path on your dev machine (customizable in Tools>Options>Debugging>Symbols: Cache symbols in this directory) and copy your application's .pdb files over to that directory. You have to copy them over with every new build, unless there's an option to do it automatically; I haven't checked because I have yet to stop celebrating my remote debugging success.

对话框中提到相对于远程机器来说,它是正确的。这是在撒谎。它与远程机器没有任何关系,只是迫使您在那里创建一个与当前用户同名的全新用户,因为Microsoft。要让断点正常工作,请遵循开发机器上的路径(在工具>中可定制的选项>调试>符号:在此目录中的缓存符号),并将应用程序的.pdb文件复制到该目录。你必须在每一个新版本中复制它们,除非有自动执行的选项;我还没有检查,因为我还没有停止庆祝我的远程调试成功。

Everything should work now.

现在应该工作的一切。

I hope that helps someone save the hours of blinding rage I've endured trying to get this to work on different machines over the years.

我希望这能帮助某人避免多年来我一直忍受的在不同的机器上工作时的那种盲目的愤怒。

#2


16  

certainly there is.
You can install msvsmon without installing visual studio.
I've done this myself on several machines.
the tricky part lays in authorization- the user running VS on your local machine needs special priviliges on the remote machine.
ms has some articles explaining the details- http://msdn.microsoft.com/en-us/library/bt727f1t.aspx,

当然有。您可以安装msvsmon而无需安装visual studio。我自己用过好几台机器。棘手的部分在于授权——在本地机器上运行VS的用户需要远程机器上的特殊特权。ms有一些解释细节的文章——http://msdn.microsoft.com/en-us/library/bt727f1t.aspx,

#3


4  

Update: Here's the links for 2017 which are not obvious to find either.

更新:这是2017年的链接,也不是很明显。

Visual Studio Remote Tools Links x64 direct link

Visual Studio远程工具链接x64直接链接

Visual Studio Remote Tools Links x86 direct link

Visual Studio远程工具链接x86直接链接

#4


1  

Taken from: how-to-implement-remote-debugging-in-visual-studio-2005

来自:-实施-远程-调试- 2005年-视觉工作室

Let's consider an example to understand this situation clearly. Molly Clark and Adam Barr are both employees at Adventure Works. Adventure Works has a Microsoft Windows NT domain named adventure-works.com. Adam is having trouble with some software that Molly wrote. Molly would like to debug this software on Adam's computer. Molly and Adam follow these steps:

让我们考虑一个例子来清楚地理解这种情况。莫莉·克拉克和亚当·巴尔都是探险公司的员工。Adventure Works拥有一个名为ad风投-works.com的微软Windows NT域名。亚当在莫莉写的软件上遇到了麻烦。莫莉想在亚当的电脑上调试这个软件。莫莉和亚当遵循以下步骤:

  • Adam doesn't have the remote debugger on his computer. To set up the remote debugger, Molly decides to share out the Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger directory on her computer. She creates a file share called Remote.
  • 亚当的电脑上没有远程调试器。为了设置远程调试器,莫莉决定在她的电脑上分享程序文件,微软Visual Studio 8\Common7\IDE\远程调试器目录。她创建了一个名为Remote的文件共享。
  • Adam runs \MollyComputerName\Remote\x86\Msvsmon.exe.
  • 亚当运行远程\ x86 \ Msvsmon.exe \ MollyComputerName \。
  • After the remote debugger starts, Adam clicks Permissions on the Tools menu to configure the remote debugger by using the Permissions dialog box. He gives Molly permission to debug.
    Note Adam could also configure the remote debugger by passing the /allow option when the remote debugger starts.
  • 在远程调试器启动之后,Adam通过使用“权限”对话框单击“工具”菜单上的“权限”来配置远程调试器。他允许莫莉调试。注意,Adam还可以通过在远程调试器启动时传递/allow选项来配置远程调试器。
  • Molly starts Visual Studio 2005.
  • 莫莉开始了Visual Studio 2005。
  • To open the Attach to Process dialog box, Molly clicks Attach to Process on the Tools menu.
  • 要打开“附加到进程”对话框,莫莉在“工具”菜单上单击“附加到进程”。
  • Molly connects to Adam's computer by entering adventure-works.com\Adam@AdamComputerName in the Qualifier box.
  • 莫莉通过在限定符框中输入adrisk -works.com\Adam@AdamComputerName连接到亚当的电脑。
  • Under Available Processes, Molly selects the worker process that her application is using and then clicks Attach.
  • 在可用进程中,莫莉选择应用程序正在使用的worker进程,然后单击Attach。
  • Molly opens a browser and provides the URL to the remote application. The execution stops where the breakpoint is placed in the application.
  • Molly打开一个浏览器并提供到远程应用程序的URL。执行停止在应用程序中放置断点的地方。