I am setting up an environment to test Visual Studio 2010, and will need to be installing a series of releases, each of which can not be uninstalled.
The plan is to install the product in a Virtual Machine, so I don’t have to reinstall my whole actual machine each time. Since the aspects of VS 2010 I want to test are the .NET Parallel Extensions, I need VMs that virtualize multiple cores, so I chose to boot Windows Server 2008 R2 with Hyper V to host my VMs.
My first task was to create my basic machine, so I created a Virtual Machine with a regular Virtual Hard Disk, and installed Windows 7 Ultimate on it. Windows 7 is probably the best OS to test Parallel .NET on.
Once the machine was ready, I had to put my thinking cap on. Basically, my initial plan was just to save a copy of the virtual hard disk, then install the current VS 2010 Beta 1 on the VM, and when the next version comes along, to just revert to the copy, recopy it, and install the new version, etc.
However, I came up with a variation of this, using Differencing Disks. With Differencing Disks, you chose a parent disk (the Windows 7 disk I created above), and then you create a new VM that points to the Differencing Disk. When in that machine, all disk writes go to the Differencing Disk, which grows dynamically, leaving the parent disk untouched (in fact, I followed a recommendation and made the parent disk file read only). I then booted the new VM and installed the VS Beta. When the next version comes along, I can repeat the procedure, and create yet another differencing disk, and a new VM that uses it, with the same W7 parent.
The screen shot above depicts the whole process: at the bottom are the disks, where W7_C.vhd is the original (read only) virtual disk, and “VS Hard Disk.vhd” is the differencing disk. Above, you see me installing the Visual Studio beta in the VM that uses the differencing disk. In the background is the Hyper V manager.
Note, in this particular case, my initial plan without Differencing Disks would have worked just fine. But the Differencing Disk approach is a great trick if want a bunch of variations of a basic install, without having to redo the whole install on each variation: just put the core, shared install in your static virtual hard disk, then install each variation in a Differencing Disk. This will also save disk space and make it easier to distribute the variation disks.
Another note: if you change the parent disk, the child disks all break. Hence making it read only so you don’t change it by accident.