当VS未安装在远程机器上时,使用DEBUG版本的远程调试应用程序 [英] Remote debugging an app with the DEBUG versions of the CRT when VS is not installed on the remote machine

查看:229
本文介绍了当VS未安装在远程机器上时,使用DEBUG版本的远程调试应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,让我说我可以可以远程调试远程计算机上的 发布 。我设置我的版本构建,与我的调试版本非常相似但我多数不得不确保调试标志没有设置。我已经处理了这一段时间,最后决定尝试,找出为什么我必须通过这一点。我还应该提到我的远程调试经验仅限于这个项目,C#程序使用C ++ / CLI(使用/ clr).DLL来调解一些关键的C ++库。我不需要调试底层的C ++ libs,但我需要调试C ++ / CLI代码。 (我提到这一点的一个原因是我不能使用/ clr标志静态链接libs)。

First let me say that I can remote debug a release build on the remote computer. I set up my release build much like my debug build but I mostly had to make sure the Debug flag was not set. I've dealt with doing this for a while and finally decided to try and figure out why I had to go through this. I should also mention that my remote debugging experience is limited to this project and the C# program uses a C++/CLI (built with /clr) .DLL to mediate to some critical C++ libs. I don't need to debug the underlying C++ libs but I do need to debug the C++/CLI code. (One reason I mention this is I can't link libs in statically while using the /clr flag).

我最近发现了 Dependency Walker ,所以我用它来看看发生了什么。出现与调试标志设置,链接器链接在MSVCR100D.DLL和MSVCP100D.DLL,当标志未设置时,它使用没有D后缀的文件。现在通常我可能只是复制我的版本的那些.DLLs到远程机器,但有一个问题。我的dev笔记本电脑VS2010是一个64位的机器,目标机器是32位。这意味着我拥有的那些DLL的唯一版本是64位。我已经安装远程调试VS2010(我在2008年同样的问题)在远程机器上,但它不包括这些.DLL的调试版本(我不知道为什么,但我假设这是由设计)。所以我的问题是:

I recently discovered Dependency Walker so I used it to see what was going on. Turns out with the debug flag set, the linker links in MSVCR100D.DLL and MSVCP100D.DLL, when the flag isn't set it uses the files without the "D" suffix. Now normally I might just copy over my versions of those .DLLs to the remote machine but there's a problem. My dev laptop with VS2010 is a 64 bit machine and the target machine is 32 bit. That means the only versions of those DLLs I own are 64 bit. I have installed the remote debugging for VS2010 (I had this same problem under 2008) on the remote machine but it doesn't include the debug versions of these .DLLs either (I'm not sure why but I'm assuming this is by design). So my questions are:


  1. 作为VS2010的注册所有者有一个有效的源32位版本的这些.DLL我可以放远程机器?

  2. 有更简单的方法来获得Debug支持吗?这是我可以更改一些其他设置,只是告诉VS不使用这两个DLL的调试版本?这里的优点是DEBUG符号将被设置和使用它的任何条件代码将工作。


推荐答案

CRT DLL的调试版本都可以在标准Visual Studio安装中使用,包括64位机器上的x86版本。

The debug versions of the CRT DLLs are all available with the standard Visual Studio installation, including the x86 versions even on 64-bit machines.

默认情况下,它们位于以下路径:

By default, they're located in the following path:

<Program Files folder>\Microsoft Visual Studio 10.0\VC\redist\Debug_NonRedist

在该文件夹下,您会发现另外两个文件夹( x64 和<$ c $

Under that folder, you'll find two additional folders (x64 and x86) that contain the debugging versions of these DLLs for the respective platforms.

但是请特别注意文件夹的名称(例如:c> x86 ),其中包含各个平台的这些DLL的调试版本。 Debug_NonRedist )。这表示这些调试DLL 不可重新分发。对于拥有VS许可证以便在其他计算机上测试他/她的代码时使用它们的开发者来说,肯定可以,但是他们不应该被分发到客户端计算机并用于运行应用程序。 (听起来像是你知道这个问题,但是对于未来的Google员工来说还是值得指出的。)

But pay special attention to the name of the folder (Debug_NonRedist). That indicates that these debug DLLs are not redistributable. It's certainly OK for a developer who owns a license for VS to use them when testing his/her code on another machine, but they should not be distributed to client machines and used to run your application. (Sounds like from your question that you know this, but it's worth pointing out anyway for future Googlers.)

您可以更改Visual Studio项目链接到的特定项目配置的CRT DLL的版本。这意味着你可以编译你的应用程序的调试版本,但告诉Visual Studio链接到CRT的完整的可再发行版本。

Alternatively, you can change which version of the CRT DLLs that a Visual Studio project links to for specific project configurations. That means that you can compile a "Debug" version of your application, but tell Visual Studio to link to the full redistributable versions of the CRT.

要做到这一点: / p>

To do that:


  1. 在解决方案资源管理器中右键单击项目,然后选择属性。

  1. Right-click on your project in the Solution Explorer and select "Properties".

确保在对话框顶部的下拉框中选择了调试配置。

Ensure that the "Debug" configuration is selected in the drop-down box at the top of the dialog.

将运行时库选项的设置更改为线程DLL(/ MD)或多线程(/ MT)。

Change the setting of the "Runtime Library" option to either "Multi-threaded DLL (/MD)" or "Multi-threaded (/MT)".

请注意,您只是告诉Visual Studio 不是使用每个选项的调试变体。他们仍然意味着同样的事情。第一个将动态链接到DLL,第二个将静态链接到你的应用程序。选择最适合您的情况。 (我经常发现配置我的Debug构建以静态链接到这样的实例很方便。)

Notice here that you're just telling Visual Studio not to use the "Debug" variants of each of these options. They still mean the same thing. The first will dynamically link to a DLL, the second will statically link the CRT into your application. Pick the one most appropriate for your case. (I often find it convenient to configure my "Debug" builds to statically link exactly for instances like this.)

这篇关于当VS未安装在远程机器上时,使用DEBUG版本的远程调试应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆