Remote Debugging of a Project Built Locally

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Standard

Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Pro and Team

Topic applies Topic applies Topic applies Topic does not apply

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

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

  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 computer. This example will use c:\temp\mymfc.exe.

To prepare the local computer

  1. On 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, type c:\temp\mymfc.exe.

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

  6. For the Remote Server Name setting, type 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 computer. Therefore, 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 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

  1. On the Project menu, choose Properties.

  2. In the mywin4mpropertiespage, click Debug.

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

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

  5. Select Use remote machine and type remote1in the adjacent text box.

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

  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 computer. For more information, see How to: Run the Remote Debugging Monitor.

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

See Also

Tasks

How to: Specify a Symbol Path

Other Resources

Remote Debugging Setup