Partilhar via


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.

NoteNote

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

  1. Start up msvsmon on remote1. For more information, see How to: Run the Remote Debugging Monitor.)

  2. Copy the executable mymfc.exe to a location on the remote machine. This example will use c:\temp\mymfc.exe.

To prepare the local machine

  1. From the Project menu, choose Properties.

  2. In the mymfc Property Pages dialog box, open the Configuration Properties folder and select the Debugging category.

  3. Change Debugger to launch to Remote Windows Debugger.

  4. For the Remote Command setting, enter c:\temp\mymfc.exe.

  5. Change Working Directory to the directory where your project is located.

  6. For the Remote Server Name setting, enter remote1.

  7. Change Connection to Remote with Windows Authentication.

  8. Change Debugger Type from Auto to Native Only (because you know you are debugging native code).

  9. Click OK.

  10. 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.

  11. 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

  1. From the Project menu, choose Properties.

  2. In the mywin4m properties page, click Debug.

  3. For the Start Action setting, select Start external program and in the adjacent text box, enter c:\temp\mywin4m.exe.

  4. Under Start Options, in the Working directory box, enter c:\temp.

  5. Select Use remote machine and enter remote1 in the adjacent text box.

  6. In the Command line arguments box, enter any arguments you want to pass to your application on the remote machine.

  7. If you want to do mixed-mode debugging of managed and unmanaged code, select Enable unmanaged code debugging.

  8. Start the Remote Debugging Monitor on the remote machine. (See How to: Run the Remote Debugging Monitor.)

  9. From the Debug menu, choose Start and begin debugging.

See Also

Other Resources

Remote Debugging Setup