I'm using VMWare8, and I was given a Visual Studio plug-in when I installed it, which seems to be used for cross-machine debugging. That is, debugging the program in the virtual machine on the VS of the host, it looks very awesome, so I studied it a little. Here's how to do it:

I've built a very simple console program to demonstrate. Breakpoints are added to the main function entry point.

Step 1: Start the virtual machine, I use an XP virtual machine, remember to install VMWare Tools, to debug. .NET programs also need to install the corresponding .NET Framework. Then, go to [Control Panel\Administrative Tools\Local Security Settings\Local Policies\Security Options] and change the sharing and security mode of Network Access: Local Account to "Classic", as shown in the figure:

Step 2: Add an account to the virtual machine that is exactly the same as the host's current login account. For example, if the host account is Edi_Wang and the password is 123456, then the same user must be created on the virtual machine, placed in the administrators group, and then use this account to log in to the virtual machine again.

Step 3: Open the virtual machine settings, in the Options tab, find Shared Folders, set it to Always Enabled, and then share the Debug directory of the VS project.

For example, if my project is: E:\DotNetProjects\VMDebugTest\VMDebugTest\bin\Debug, then I will open this directory in the share, as shown in the following figure.

This step is important and will need to be used for the VMWare Debug plugin in VS later. If this path can be accessed in the virtual machine, it means that the setting is successful. At this point, the setup on the virtual machine is complete.

Step 4: Find the VMWare plugin on the toolbar of VS and open the settings interface.

We need to specify:
 
  • Virtual Machine: Specifies the virtual machine that we are currently running
  • Guest Command (Important): Specify the path you just configured, i.e., \\vmware-host\Shared Folders\Debug\VMDebugTest.exe. Be careful not to enter directly, click the small arrow on the right, and select the run guest command to set it successfully.
  • Shared Folders: The same as the sharing configuration just before, it is specified as the Debug folder, pointing to E:\DotNetProjects\VMDebugTest\VMDebugTest\bin\Debug

The other options should be specified by default, if there is a mistake, you can change it yourself.

Then, we can start debugging, with pictures and truths: