Remotely debug a C++ project - Visual Studio (Windows) (2023)

  • article

Applies to: Remotely debug a C++ project - Visual Studio (Windows) (1)visual studyRemotely debug a C++ project - Visual Studio (Windows) (2)Visual Studio for MacRemotely debug a C++ project - Visual Studio (Windows) (3)visual study code

To debug a Visual Studio application on another computer, install and run the remote tools on the computer where you want to deploy the application, configure your project to connect to the remote computer from Visual Studio, and then deploy and run the application.

Remotely debug a C++ project - Visual Studio (Windows) (4)

For information about remote debugging of Universal Windows Apps (UWP), seeTroubleshoot installed application packages.

Demand

Remote debugging is supported on Windows 7 and later versions and Windows Server versions starting with Windows Server 2008 Service Pack 2. For a complete list of requirements, seeDemand.

noting

Debugging between two computers connected via a proxy is not supported. Debugging over high-latency or low-bandwidth connections (such as Internet dial-up) or cross-country Internet is not recommended and may fail or be unacceptably slow.

On the remote device or server that you want to debug (not on the Visual Studio computer), download and install the correct version of the remote tools from the link in the table below.

  • Download the latest remote tools for your version of Visual Studio. The latest version of Remote Tools is compatible with older versions of Visual Studio, but earlier versions of Remote Tools are not compatible with newer versions of Visual Studio. (For example, if you are using Visual Studio 2019, download the latest update for Remote Tools for Visual Studio 2019. In this case, do not download Remote Tools for Visual Studio 2022.)
  • Download a remote tool that has the same architecture as the computer you want to install on. For example, if you want to debug a 32-bit program on a remote computer with a 64-bit operating system, you must install 64-bit remote tools.
  • To remotely debug an ARM64EC application on an ARM64 device, install the ARM64 remote tools and start the x64 remote debugger that was installed with those tools. This can be found at:Programfiler (x86)\Microsoft Visual Studio\Common7\IDE\Remote Debugger\x64.
Versionfellownoting
Visual Studio 2022remote toolCompatible with all versions of Visual Studio 2022. Download the version that matches your device's operating system (x86, x64 or ARM64). On Windows servers, seeUnblock file downloadsGet help downloading remote tools.
Visual Studio 2019remote toolCompatible with all versions of Visual Studio 2019. Download the version that matches your device's operating system (x86, x64 or ARM64). On Windows servers, seeUnblock file downloadsGet help downloading remote tools.
Visual Studio 2017remote toolCompatible with all versions of Visual Studio 2017. Download the version that matches your device's operating system (x86, x64 or ARM64). On Windows servers, seeUnblock file downloadsGet help downloading remote tools.
Visual Studio 2015remote toolRemote Tools for Visual Studio 2015 are available from My.VisualStudio.com. Sign up for free if promptedVisual Studio development essentialsprogram or sign in with your Visual Studio subscription ID. On Windows servers, seeUnblock file downloadsGet help downloading remote tools.
Visual Studio 2013remote toolThe download page in the Visual Studio 2013 documentation
Visual Studio 2012remote toolThe download page in the Visual Studio 2012 documentation
Versionfellownoting
Visual Studio 2019remote toolCompatible with all versions of Visual Studio 2019. Download the version that matches your device's operating system (x86, x64 or ARM64). On Windows servers, seeUnblock file downloadsGet help downloading remote tools. For the latest version of Remote Tools, openVisual Studio 2022 Documentation.
Visual Studio 2017remote toolCompatible with all versions of Visual Studio 2017. Download the version that matches your device's operating system (x86, x64 or ARM64). On Windows servers, seeUnblock file downloadsGet help downloading remote tools.
Visual Studio 2015remote toolRemote Tools for Visual Studio 2015 are available from My.VisualStudio.com. Sign up for free if promptedVisual Studio development essentialsprogram or sign in with your Visual Studio subscription ID. On Windows servers, seeUnblock file downloadsGet help downloading remote tools.
Visual Studio 2013remote toolThe download page in the Visual Studio 2013 documentation
Visual Studio 2012remote toolThe download page in the Visual Studio 2012 documentation

You can run the remote debugger by copyingmsvsmon.exeon the remote computer instead of installing remote tools. However, the Remote Debugging Configuration Wizard (rdbgwiz.exe) are only available if you have remote tools installed. If you want to run the remote debugger as a service, you may need to use the wizard to set it up. For more information, see(Optional) Configure the remote debugger as a service.

noting

  • To debug Windows 10 or newer apps on ARM devices, use ARM64, which works with the latest version of Remote Tools.
  • To debug Windows 10 apps on Windows RT devices, you must use ARM, which is only available in the Visual Studio 2015 Remote Tools download.

trace

In some cases, it may be more efficient to run the remote debugger from a shared file. For more information, seeRun the remote debugger from a shared file.

Configure an external debugger

  1. Find and start on the remote computerremote debuggerfromPrinciplemenu.

    If you do not have administrator rights on the remote computer, right-clickremote debuggerapplication and selectrun as administrator. Otherwise, it can start normally.

    If you plan to attach a process that is running as an administrator or under another user account (such as IIS), right-clickremote debuggerapplication and selectrun as administrator. For more information, seeRun the remote debugger as an administrator.

  2. When you start the remote debugger for the first time (or before you set it up),Configure remote debuggingThe wizard appears.

    In most scenarios, you have to chooseNextuntil you arriveConfigurer Windows Firewallguide page.

    Remotely debug a C++ project - Visual Studio (Windows) (5)

    Remotely debug a C++ project - Visual Studio (Windows) (6)

    If the Windows Web Services API is not installed (this only happens on Windows Server 2008 R2), selectSetting upbutton.

  3. Select at least one type of network you want to use the remote tool on. If the computers are connected through a domain, the first point must be selected. If the computers are connected through a workgroup or a homegroup, select the second or third point, as appropriate.

    Then chooseExitStart the remote debugger.

    Then chooseConfigure remote debuggingStart the remote debugger.

  4. When the configuration is complete,remote debuggerThe window appears.

    Remotely debug a C++ project - Visual Studio (Windows) (7)

    Remotely debug a C++ project - Visual Studio (Windows) (8)

    The remote debugger is now waiting for a connection. Configure the remote connection in Visual Studio using the server name and port number shown.

To stop remote debugging, selectdocument>Exit. You can restart it fromPrinciplemenu or from the command line:

\msvsmon.exe

noting

If you need to add permissions for other users, change the authentication mode or port number of the remote debugger, seeConfigure the remote debugger.

Remote debugging of C++ projects

In the following procedure, the path to the project is C:\remotetemp and the name of the remote computer ismy surface.

  1. Create a C++ console application calledCppConsoleApp

  2. Set a breakpoint somewhere in your application that is easy to reach, e.g.CppConsoleApp.cpp, indthe most importantWork.

  3. In Solution Explorer, right-click the project and selectcharacteristic. Openerror correctionTicket.

  4. Regulationthe debugger to startreachRemove the Windows Debugger.

    Remotely debug a C++ project - Visual Studio (Windows) (9)

  5. Make the following changes to the properties:

    environmentvalue
    remote controlC:\remotetemp\CppConsoleApp.exe
    Task listC:\Remove temporary files
    remote server namemy surface:The port number
    connect-connectRemote control using Windows authentication
    debugging typelocal only
    implementeringsmappeC:\Remove temporary files
    Additional files to develop$(project folder)\data

    If you are deploying to a different folder and want to deploy all files in the folder to the same folder, specify the folder name.

    For more information about the properties, seeProject settings for C++ debug configurations.

  6. In Solution Explorer, right-click the solution and selectconfiguration manager.

  7. toerror correctionconfiguration, selectionentercontrol box.

    Remotely debug a C++ project - Visual Studio (Windows) (10)

  8. start debugging (Debug > Start Debugging, theF5).

  9. Executable files are automatically deployed on remote computers.

  10. If prompted, enter your network information to connect to the remote computer.

    The required credentials are specific to your network security configuration. On a domain computer, you can e.g. select a security certificate or enter a domain name and password. On a computer without a domain, you can enter the computer name and a valid user account name, such asMySurface\name@noget.comand the correct password.

  11. On the Visual Studio desktop, you should see execution stop at the breakpoint.

    trace

    Alternatively, you can deploy these files as separate steps. insidesolution exploration,Right click on the project node and selectenter.

    If you have non-code files required by your application, you can list them in a semicolon-separated list in the following locations:Additional files to developexistsRemove the Windows DebuggerSide.

    Alternatively, you can include these files in your project and then setcontentsproperty inAndindecharacteristicpages for each file. These files are copiedimplementeringsmappeis specified inRemove the Windows DebuggerPage. You can also changeObject typereachcopy filesIf you need to copy the file to a subfolder of this file, you must specify additional propertiesimplementeringsmappe.

Configure debugging with remote symbols

You should be able to debug your code using the symbols generated in your Visual Studio desktop. The remote debugger works much better when you use local symbols.

If you need to use remote symbols, specify the remote symbols in Visual Studio by adding the Windows shared file to the symbol search pathTools > Options > Debug > Symbols.

See also

  • Debugging in Visual Studio
  • First look at the debugger
  • Configure Windows Firewall for remote debugging
  • Assign an external debug port
  • Remotely debug ASP.NET on a remote IIS computer
  • Remote troubleshooting and troubleshooting

References

Top Articles
Latest Posts
Article information

Author: Greg Kuvalis

Last Updated: 12/09/2023

Views: 5955

Rating: 4.4 / 5 (75 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Greg Kuvalis

Birthday: 1996-12-20

Address: 53157 Trantow Inlet, Townemouth, FL 92564-0267

Phone: +68218650356656

Job: IT Representative

Hobby: Knitting, Amateur radio, Skiing, Running, Mountain biking, Slacklining, Electronics

Introduction: My name is Greg Kuvalis, I am a witty, spotless, beautiful, charming, delightful, thankful, beautiful person who loves writing and wants to share my knowledge and understanding with you.