Why use a virtual machine for development?
There are a couple things I like about doing development on a virtual. One of the best features is creating the image once and then being able to have the other developers use the same image. This is a big time saver and ensures consistency across the developers. In addition to having all of the developers use the same image, this also allows us to have separate images for each of our clients. This obviously allows us to keep our clients data and code separate and helps prevent 3rd party controls from conflicting.
Performance
Defrag. Defrag. Defrag. This is must whether you are using a virtual machine or physical only. I have a created a scheduled task to defrag my machine every day. Here are some steps for creating the scheduled defrag. I do it daily because the more often it runs the quicker it will complete. Newer PCs with Intel processors have a virtualization bios setting that is turned off by default. This is supposed to help virtualization performance. When I enabled it on my laptop, it caused my machine to temporarily quit responding. I ended up turning it back off. I recommend enabling it and trying it. The other option to consider is where to save the virtual disk. My laptop has a 7200rpm hard drive and I have a 5400rpm USB Buffalo external drive. I thought the virtual would run better from my local drive but since that is the drive with my swap file and the OS, the virtual image runs faster from my external drive. Both USB 2.0 and Firewire (400) are half duplex so technically data can’t transfer both directions at the same time on the USB. Firewire 800 does support full duplex. If your computer supports this, eSata, or has a second hard drive, I recommend using one of the first, USB 2.0 second, and the C: drive last.
Configuring for Team Foundation Server 2008
When creating your base image, install of of the required software. For TFS, this includes VSTS 2008 (any edition), Team Explorer, and SP1. Do not connect to the TFS Server. TFS will automatically create a workspace for your machine that is not needed. TFS workspaces use the machine and user as the key for unique workspaces. The workspace displays the machine name but uses the machine’s SID (basically a machine GUID). Each copy of the base image that is created, needs to have the machine name and SID changed. The official way to do this is to use SysPrep. I found a handy utility by SysInternals (owned by Microsoft) that can do it called NewSID. there is a disclaimer on the website stating that it isn’t officially supported by Microsoft but I have been using with XP and Windows 2003. I haven’t run into any problems. It is a simple wizard that allows you to enter the new machine name and it creates a new SID. After the reboot it is ready to go.
If you make a copy of a machine that has already been connected to TFS, even after updating the machine name and SID you could still get the error message “The workspace “USER;MACHINENAME” already exists on computer MACHINENAME. TFS caches this information on the machine. To update the cache run use the Visual Studio Command Prompt and run
tf workspaces /updateUserName:USERNAME/s:http://tfsserver:8080
Run this for both the original user and the new user of the machine. This should clear the cache and allow you to create a workspace to the same folder as before.
I hope this helps.
-Mike