Remote Debugging of a Project Built Locally

This topic applies to:

Edition

Visual Basic

C#

F#

C++

Web Developer

Express

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

Pro, Premium, and Ultimate

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

You might want to debug a project that is built locally and then 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 on 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 on the Symbols page in the Options dialog box. For more information, see How to: Specify Symbol Locations and Loading Behavior.

Visual C++

The procedure shown here assumes that you have an MFC project, mymfc, built on computer local1. You want to run the application mymfc.exe on computer remote1, and then debug by 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 software edition. To change your settings, select Import and Export Settings on the Tools menu. For more information, see Working with 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, select Properties.

  2. In the mymfc Property Pages dialog box, expand the Configuration Properties node and click Debugging.

  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 Symbol Locations and Loading Behavior.

  11. On the Debug menu, select Start and begin debugging.

Visual C#/Visual Basic

The procedure shown here 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 then debug by using the Visual Studio debugger on computer local1.

To prepare the remote computer

  • Copy the executable mywin4m.exe to a location on the remote computer, together with the associated PDB file (mywin4m.pdb) and DLLs or other files that are required to run the program.

    This example will use c:\temp\mywin4m.exe.

To prepare the local computer

  1. On the File menu, point to Open and click Project/Solution.

  2. In the Open Project dialog box, find mywin4m.exe on the local or remote computer.

  3. Select mywin4m.exe, and then click OK.

  4. In Solution Explorer, right-click the project, and then click Properties.

  5. On the mywin4m properties page, click Debug.

  6. In the Working directory text box, type c:\temp.

  7. In the Machine name text box, type remote1.

  8. (Optional) Under Debugger Type, select Mixed mode to explicitly enable debugging of both managed and unmanaged code.

  9. Start the Remote Debugging Monitor on the remote computer, and set the remote debugging mode to either Windows Authentication mode or No Authentication mode.

    For more information, see How to: Run the Remote Debugging Monitor.

  10. On the Debug menu, select Start and begin debugging.

See Also

Tasks

How to: Specify Symbol Locations and Loading Behavior

Other Resources

Remote Debugging Setup