Export (0) Print
Expand All

Set Up Remote Debugging for a Visual Studio Project

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 a Windows Desktop app on a remote computer.

These examples assume that the Visual Studio Remote Debugging Monitor has already been set up on the remote computer. See Remote Debugging and Diagnostics.

The topic contains these examples:

Set up a Visual C++ project

Set up a Visual C#/Visual Basic project

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 in the c:\RemoteTemp folder, and then debug by using the Visual Studio debugger on computer local1. Additionally, you want to copy the file c:\Data\MyMfcData.txt to the remote computer.

Note 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 Customizing Development Settings in Visual Studio.

To prepare the remote computer

To prepare the Visual Studio computer

  1. On the Project menu, select Properties.

  2. In the MyMfc Property Pages dialog box, expand the Configuration Properties node and choose Debugging.

    MyMfc project debugging property page
  3. Make the following changes to the properties:

    Setting

    Change

    Debugger to launch

    Choose Remote Windows Debugger.

    Remote Command

    Type c:\remotetemp\mymfc.exe.

    Working Directory

    Change to c:\remotetemp.

    Remote Server Name

    Type remote1.

    Connection

    Make sure it is set to Remote with Windows Authentication.

    Debugger Type

    Change from Auto to Native Only, because you know you are debugging native code.

    Deployment Directory

    Change to c:\remotetemp.

    Additional Files to Deploy

    Change to c:\data\mymfcdata.txt.

  4. On the toolbar, open the Solution Configuration drop-down menu, and choose Configuration Manager.

  5. For the Debug configuration, select the Deploy check box.

    Configuration Manager dialog box
  6. On the Debug menu, select Start and begin debugging.

    Tip Tip

    The Debug command automatically deploys (copies) the project output and additional files to the remote computer. You can deploy the files as a separate step. In Solution Explorer, open the context menu for MyMfc, and then choose Deploy.

The procedure shown here assumes that you have a WPF app project, MyWpf, built on computer local1. You want to run the application MyWpf.exe on computer remote1, and then debug by using the Visual Studio debugger on computer local1.

To prepare the remote computer

To prepare the Visual Studio computer

  1. Open the MyWpf project in Visual Studio.

  2. On the Project menu, choose Properties.

  3. On the MyWpf properties page, choose Debug.

    Debug project property page
  4. In the Working directory text box, type c:\remotetemp.

  5. Choose Use remote machine, and type remote1 in the text box.

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

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

To deploy additional files to the remote computer

  1. (Optional) Create a project folder for the additional file. Select the project in Solution Explorer. On the context menu, choose Add, New Folder. Copy the data file to the new folder.

  2. Add the file to your Visual Studio project. Select a project directory in Solution Explorer. On the context menu, choose Add, Add Existing Item and select the file.

  3. In Solution Explorer, select the file and choose Properties.

    Data file properties
  4. Select Copy always from the Copy to Output Directory list.

Show:
© 2014 Microsoft