Partager via


Remote Debugging in Visual Studio 2008

Common scenario is that a developer wrote an application on his/her dev machine A (which has source code, etc), and wants to debug this application's source code when the application is running on the remote machine B. Visual Studio 2008 provides two ways to help with this scenarios easily. Read the https://msdn.microsoft.com/en-us/library/bt727f1t.aspx. Basically, you can use "Attach Process" way to attach the program which runs on the remote machine to debug it, and you also can "Start the external program" that you want to debug on the remote computer. Usually I use the second way, because it is very easy for debugging the launching process.

Here, I summarize a few steps to run the Remote Debugging Monitor (msvsmon.exe) on the remote computer B and set properties of Visual Studio for remote debugging a managed (C#) application.

The details steps are

  1. Share msvsmon.exe on a file server, for example \\MyMachine\x64\msvsmon.exe
  2. On the remote machine B double click msvsmon.exe from the above file share link
  3. After the remote debugging monitor launched, go to the Tools->Options, make sure your dev machine A has permission over there
  4. On your dev machine A, open the corresponding project in VS 2008, go to project properties->Debug, set the following paramters
    • Start Action->Start external program: \\remotemachine\applicationExample.exe
    • Start Options->Command line arguments: -your ags (if your application needs)
    • Start Options->Use remote machine (checked the check-box) : YourRemoteMachineName (make sure it is matched with the one you can see on Debugging Monitor dialog box Tools->Options->RemoteName) [See the following picture]
  5. Click F5

That is it! You can debug it as if the application is running on your dev machine (the application is actually running on the remote machine). :)

Key point: Make sure your application is built with symbols.