Remote Debugging of a Project Built Locally
This topic applies to:
Edition |
Visual Basic |
C# |
C++ |
Web Developer |
---|---|---|---|---|
Express |
||||
Standard |
||||
Pro and Team |
Table legend:
Applies |
|
Does not apply |
|
Command or commands hidden by default. |
You might want to debug a project that is built locally and run the executable on a remote computer. This topic explains how to change your local project settings to run the executable on a remote computer.
These examples assume that remote debugging has already been set up on the remote computer or that you are running the remote debugger from a share. If you want to install remote debugging on the remote computer, see Remote Debugging Setup.
Note
When you are debugging managed code, the debugger expects to find symbol files on the remote computer instead of the local computer. Therefore, you must copy the symbol files to the appropriate directory on the remote computer. To determine where the debugger looks for symbols on the remote computer, use the Debugging node Symbols page in the Options dialog box. For more information, see How to: Specify a Symbol Path .
Visual C++
This example assumes that you have an MFC project mymfc built on computer local1. You want to run the application mymfc.exe on computer remote1 and debug using the Visual Studio debugger on computer local1.
Note
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.
To prepare the remote computer
Start up msvsmon on remote1. For more information, see How to: Run the Remote Debugging Monitor.)
Copy the executable mymfc.exe to a location on the remote computer. This example will use c:\temp\mymfc.exe.
To prepare the local computer
On the Project menu, choose Properties.
In the mymfc Property Pages dialog box, open the Configuration Properties folder and select the Debugging category.
Change Debugger to launch to Remote Windows Debugger.
For the Remote Command setting, type c:\temp\mymfc.exe.
Change Working Directory to the directory where your project is located.
For the Remote Server Name setting, type remote1.
Change Connection to Remote with Windows Authentication.
Change Debugger Type from Auto to Native Only because you know you are debugging native code.
Click OK.
Set the Symbol Path to a location on local1 where the debug symbols can be found. Native remote debugging cannot use symbols from a remote computer. Therefore, you must give a local location. For more information see How to: Specify a Symbol Path.
From the Debug menu, choose Start and begin debugging.
Visual C#/Visual Basic
This example assumes that you have a Windows Application project mywin4m built on computer local1. You want to run the application mywin4m.exe on computer remote1 and debug using the Visual Studio . debugger on computer local1.
To prepare the remote computer
- Copy the executable to a location mywin4m.exe on the remote computer together with the associated PDB (mywin4m.pdb) and DLLs or other files that are required to run the program. For this example, use the location c:\temp\mywin4m.exe.
To prepare the local computer
On the Project menu, choose Properties.
In the mywin4mpropertiespage, click Debug.
For the Start Action setting, select Start external program and in the adjacent text box, type c:\temp\mywin4m.exe.
Under Start Options, in the Working directory box, type c:\temp.
Select Use remote machine and type remote1in the adjacent text box.
In the Command line arguments box, type any arguments you want to pass to your application on the remote computer.
If you want to do mixed-mode debugging of managed and unmanaged code, select Enable unmanaged code debugging.
Start the Remote Debugging Monitor on the remote computer. For more information, see How to: Run the Remote Debugging Monitor.
On the Debug menu, choose Start and begin debugging.