Remote Debugging of a Project Built Locally
This topic applies to:
Visual Studio Edition |
Visual Basic |
C# |
C++ |
J# |
Web Dev |
Express Edition |
No |
No |
No |
No |
No |
Standard Edition |
No |
No |
No |
No |
No |
Pro/Team Edition |
Yes |
Yes |
Yes |
Yes |
Yes |
You may want to take a project that is built locally and run the executable on a remote machine for debugging. This topic explains how to change your local project settings to run the executable on a remote machine.
These examples assume that remote debugging has already been set up on the remote machine (or that you are running the remote debugger from a share). If you need to install remote debugging on the remote machine, see Remote Debugging Setup.
Visual C++
This example assumes that you have an MFC project mymfc
built on machine local1
. You want to run the application mymfc.exe
on machine remote1
and debug using the Visual Studio debugger on machine 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 machine
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 machine. This example will usec:\temp\mymfc.exe
.
To prepare the local machine
From 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, enter
c:\temp\mymfc.exe
.Change Working Directory to the directory where your project is located.
For the Remote Server Name setting, enter
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 machine, so 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 machine local1
. You want to run the application mywin4m.exe
on machine remote1
and debug using the Visual Studio .NET debugger on machine local1
.
To prepare the remote machine
- Copy the executable
mywin4m.exe
to a location on the remote machine (for this example,c:\temp\mywin4m.exe
., along with the associated PDB (mywin4m.pdb
) and DLLs or other files necessary to run the program.
To prepare the local machine
From the Project menu, choose Properties.
In the mywin4m properties page, click Debug.
For the Start Action setting, select Start external program and in the adjacent text box, enter
c:\temp\mywin4m.exe
.Under Start Options, in the Working directory box, enter
c:\temp
.Select Use remote machine and enter
remote1
in the adjacent text box.In the Command line arguments box, enter any arguments you want to pass to your application on the remote machine.
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 machine. (See How to: Run the Remote Debugging Monitor.)
From the Debug menu, choose Start and begin debugging.