Do you run Sitecore remotely but want to debug your code locally? Visual Studio supports remote debugging. There are a number of websites that describe how to configure remote debugging, but some things bear repeating.
I am writing this post with a specific scenario in mind: Sitecore is running in a virtual machine and Visual Studio is running on my local machine. I want to be able to develop my code locally, deploy to the virtual machine, and debug my code locally.
My local machine is running Windows 7. I log into an Active Directory domain. My virtual machine is running Windows Server 2008 R2 on VMware Workstation 7.1.
The first step is to configure the remote debugger service on the virtual machine (which, in this setup, is also called the remote machine). This service must run using a local account with the same user name and password as the account I log into my local machine with (meaning the account that is running Visual Studio).
The next step is to configure the local machine. If you log into your local machine with a local user account, this step can be ignored. However, if you log into your local machine using a domain account, there is an additional step. In order for remote debugging to work, I need to create a local account with the same user name and password as my domain account. This account should also be a member of the local Administrators group.
Now I am able to use remote debugging. In Visual Studio, when I want to debug I use the menu option Debug > Attach to Process.
In the Attach to Process screen, I enter the name of my remote server in the Qualifier box and press the Enter key. Visual Studio shows a list of processes I can debug. Sitecore runs in the w3wp process, so I select that process and click the Attach button.
Here are a couple of other notes that should help you get started:
Adam, this is the exact way I've been working for four+ years now! Local Visual Studio with Sitecore(s) running on a Virtual Machine. I actually documented it here: seankearney.com/.../Visual-Studio-Projects-and-Sitecore.aspx How do you handle the pushing of compiled code to your VM? I used to use post build steps, but this clunky'ness one of the reasons we created TDS. You should be able to remove the need to "Attach to Process" too. On the 'Web' tab of the properties for your Web Application project you should choose the "Use Custom Web Server" option and enter in your development Sitecore URL. Once this setting has been specified you can now press F5 to build your project and debug normally. This may require some IIS components to be enabled, depending on your system.