Remote debugging C# code using Visual Studio 2008

While there are articles, such as MSDN and other blogs, setting up a remote debug for a C# app is not easy. This is due to the lack of details in those articles. So, here's my tips to fill in the missing pieces.

Setting up the target Windows

User account

Set up a user account on the target machine (where the application runs) and make the username and password exactly the same as the host machine (where VS2008 runs).

Log on

Log on using the account set up above to the remote PC. Run msvsmon.exe.

Debugging

Path

When you have built and created the executable, place the file exactly the same path as on the host PC.

Project Properties

From Solution Explorer, right click the project and choose Properties. On Debug tab, check "Use remote machine" and specify the host name of the remote PC.

Start Debugging

Now, when you start debugging, either by hitting F5 or choosing 'Start Debugging' from the menu, the executable of the remote machine will start.

Attaching to the process

If you've already started the process on the remote machine, from Debug menu, choose Attach to Process... Using Default for Transport, specify the target host name. Then attach to the process.

Here are some useful web site articles.

http://msdn.microsoft.com/en-us/library/bt727f1t.aspx
http://blogs.techrepublic.com.com/programming-and-development/?p=675
http://www.wictorwilen.se/Post/How-to-get-Remote-Debugging-work-properly...