CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Mark DiGiovanni

Software Development and Supporting Technologies

Optimizing Development with Microsoft Virtual PC 2004

Generally speaking, my pre-Virtual PC development configuration installed on my laptop consisted of a single installation of Windows XP Pro, SQL 2000, Visual Studio.NET 2003, NUnit, and various other tools. With this configuration, I developed several different applications.

It wasn't long before I began development on a Microsoft Content Management Server 2002 solution for a client. I installed MCMS 2002. I was working on a development team that had one central development SQL Server as the repository. Well, CMS requires constant communication with this database or else NONE of the ASP.NET applications will run (KB Article on this issue). When I was disconnected from their network, I had to point MCMS to a local database. This got old --fast. As a result of this engagement, my standard pre-Virtual PC installation got pretty muddy.

Recently, I did some SharePoint 2003 Portal Server development which requires Microsoft Windows Server 2003. The problem is, I did not have a server OS installed on my computer. This caused me to rethink the way I configure my laptop for enterprise development.

Rather than slick my laptop and install Windows Server, SharePoint, etc., I looked at the feasibility of performing this development in a virtual machine. I researched the hardware requirements, and got a faster hard drive (7200rpm Appricorn drive). My memory was already maxed out at one gig.

To make a long story short, I successfully developed my portions of the portal within the VPC image. The standard install on my laptop now consists only of Windows XP Pro, Office 2003, Virtual PC 2004, and some other software. I did not install any development software on the base image. I created a base development VPC image consisting of Windows XP Pro and Visual Studio.NET 2003 with the most recent service packs. I derive all other VPC images (except those requiring Windows Server) from this one. I physically copy the image, rename it, and run NewSID. The virtual hard disk is configured to be "dynamically Expanding" rather than "Differencing." I do this mainly because it can take some time to save the differences.

Configuring

I like the mobility of a laptop, but one of the drawbacks is it's form factor. I cannot just add more disk space. Right now, I only have a 60 gig hard drive. At the moment, I have four VPC images on my computer. To save space, I came up with the following solution.

First, create another virtual hard drive and configure each VPC to use it as a secondary drive. Then, when installing an application like Visual Studio.NET, install it to the secondary drive from each VPC image. This will put the application files from all VPC images in the same location. A full install of Visual Studio.NET is over one gig in size. Why have these same files in more than one place on the same computer? I did the same thing with the MSDN documentation and several other programs that each VPC must have.

Here's how to do it

(Quick links) Virtual Disk Wizard | Initialize & Partition Disk | Conclusion | Additional Tools to Consider

Step 1. Start Virtual PC 2004 and click File > Virtual Disk Wizard. This will launch the Virtual Disk Wizard. You will use this to create your additional virtual hard drive that will be shared by all VPC images.

Step 2. Set the new virtual hard disk to your VPC image by selecting the VPC image and clicking the "Settings" button. Start the VPC image.


Step 3. When Windows starts, it will detect the new hard drive and you will see a balloon appear in the taskbar.

Open the Computer Management console and expand "Storage" and click on "Disk Management." The console is located in the Administrator Tools folder. The hard disks are then displayed on the right. Right click on the "Unknown" disk and click "Initialize Disk."

Click "OK" on the below prompt. Next right click the disk again, this time clicking New Partition..." causing the New Partition Wizard to start.

If you receive the below prompt, click "OK" and refresh the console.


The new drive is now setup on your VPC image. To configure a second VPC image to use this new virtual disk, repeat step two. The drive should be ready to go. If the drive does not show up, go back into the Computer Management console and make sure that the drive is initialized.

Conclusion

My development experience has significantly changed since using VirtualPC 2004. For example, I do not need to muddy my base install when testing out Visual Studio.NET Beta 2 (April 25, 2005). All I have to do is make a copy of my base VPC image, and install this beta. When I'm finished, I can just delete it. I can also enable Undo Disks for a working VPC image in the settings. This gives the option to save or discard any changes that have been made during a session. VirtualPC also allows a "virtual network" to be created on one computer allowing some testing to be done that otherwise would be impossible without several computers. In addition, a second or third virtual disk can be configured for use by each VPC image. This allows programs to be installed on each image, but share the same program files.

Additional Tools to Consider

NewSID : Use this program to change the VPC image's SID and Computer Name. It is very important to let this program change both of these properties. Read their warning about it.

VirtualDrive Utility & Burning Suite : I use this program to make VCD (Virtual Drive) images of my installation CDs. These VCD images reside on my base installation. They can be switched to ISO format at any time. Whenever I need to install something, I insert a VCD image into a Virtual Drive, and run the program. For example, I performed a minimal install of the MSDN help software to the shared VirtualPC disk from each of my Virtual PC images. I then created three additional CD drives (Virtual Drives) from the VirtualDrive utility. I inserted MSDN disk one, two, and three into each drive that I created. Whenever the help tells me to insert a disk, I tell the VPC image to use "Physical Drive [X]:" from the CD menu of the VPC menu bar. When the new MSDN documentation CDs come out (once a quarter), I delete my old VCD images, and create new ones.

 



Comments

Mark DiGiovanni said:

I've written an article about Optimizing Development with Microsoft
Virtual PC 2004.  This product...
# April 12, 2005 10:02 AM

jlynch said:

Excellent article! I'm gonna do exactly the same on my dev notebook!
# April 12, 2005 11:50 AM

Lorenzo Barbieri @ UGIblogs! said:

# April 13, 2005 1:06 AM

Lorenzo Barbieri @ UGIblogs! said:

# April 15, 2005 4:45 AM

Lorenzo Barbieri @ UGIblogs! said:

# April 15, 2005 4:47 AM

John Papa said:

Good article, Mark.

I just followed the setup you described to install VS.NET 2005 Beta 2. Its installing now and will likely take a few years ;-) I have a C disk (the base image) and I have a second disk (vhd) setup as you described in the article. When I install VS.NET 2005 beta 2 (or most programs), even though I choose to install it on the second disk, some files still want to go to the system disk (my base image). I'm assuming this means that I cannot use ths base image for anything that is not compatible with VS.NET 2005 beta 2 sys files.

Did I miss something in your article? I was hoping I could keep the base clean and use the 2nd disk for beta apps like this. (I made a copy of the base, just in case too)
# April 17, 2005 7:55 PM

mdigiovanni said:

John,

The base image is an installation that you create without a development environment installed. Just install Windows, Office, etc. on it. Then make a physical copy of the virtual hard disk of the base image. Then install Visual Studio Beta 2 to the copy. You will still point the installation to the second hard disk. Some files will go to the system drive.

To do this, step through the wizard to create a new virtual machine and point it to the copy virtual hard disk.

Does this help?

--Mark
# April 18, 2005 7:07 AM

John Papa said:

Mark,

Yeah that's what I did. It works and yeah, some files do get installed on the system drive. But that is why I made the copy of the base install (and because you recommended it). I plan on installing SQL Server 205 April CTP to this install, too. Do you suggest installing it to the same hard disk as VS.NET 2005 beta 2? Or copying both images again?

I have to tell you that VS.NET 2005 beta 2 is dog slow on my Virtual PC instance. I gave it 512 MB RAM (from my P4 2.4 Ghz base computer's 1GB of RAM) but it just painfully chugs along. I am considering buying a low end PC just for beta's again like I used to. Before I shell out a few hundred bucks for that, can you think of anything I can try to optimize the VPC instance?
# April 19, 2005 11:24 AM

mdigiovanni said:

John,

First, I use a professional strength defragger on my virtual machines and host machine.

try the 30 day trial: http://www.perfectdisk.com/. This has helped significantly.

Second, try starting Virtual PC with the following switch: -usehostdiskcache.

Create a shortcut to Virtual PC.exe. Put this switch outside of the quotes.

This will speed things up, but may leave your virtual hard disk in an unstable state if your host computer crashes or something of that nature. I figure if its beta, then it's going to crash anyway :).

Here is a list of other command switches and what they do: http://support.microsoft.com/default.aspx?kbid=831501&product=vpcwin2004 .

--Mark
# April 20, 2005 6:19 AM

mdigiovanni said:

# April 20, 2005 6:32 AM

L.Luu said:

Mark,

You mentioned that you installed SharePoint Portal Server 2003 on your virtual pc. Did you also install SQL Server 2000? If so, I keep running into an issue during configuration of the Database Settings on the Portal server. The error displays:

Error accessing database. Verify that the database server name and the instance name (if present) are correct. Also, ensure the configuration database administration account has sufficient permissions on the server or instance and the service corresponding to your SQL Server instance is running.

When deploying on regular servers, this part is never a problem. It only gives me issues when I try it on Virtual PC or Virtual Server. Can you help me?

Thanks!
L.Luu
# July 18, 2005 7:51 AM

mdigiovanni said:

L. Luu,

I have in the past installed SQL on my VPC image. Make sure that your app pool accounts have the correct privs to access the database. Check the SQL permissions for the account.

--Mark
# July 20, 2005 10:12 AM

EROL said:

On my BLOG EROL
# August 21, 2005 1:56 AM

John Papa said:

I went out to grab the VS.NET 2005 Release Candidate and the SQL Server 2005 September CTP a few days...
# September 22, 2005 12:58 PM

DerekTheGeek said:

Thanks for a great article! I had a question about sharing your application drives. Suppose you have two virtual machines each with their own virtual hard drive. If you have a common application drive that they share would you not end up overwriting files that are already there? Would you run the risk of altering settings present on another virtual machine? Or are all settings maintained on the virtual drive specific to each virtual machine?

Thanks.. Derek
# September 27, 2005 4:25 PM

Ray said:

Thanks for the article! My question though is on how to make my VPC image work faster. I have installed VS. NET 2005, SQL server, Windows SharePoint Services, VSS, etc. and it seemed that the performance weakened. I have alloted 512 MB of memory to my virtual machine and i only have one fixed sized virtual hard disk. Can you help me with configurations/settings to my VPC so it would run faster? Thanks a lot!
# March 29, 2006 9:57 PM

Amit said:

Can you suggest me hardware requirement in a scenario when im using SQL Server2000 and VS.Net 2005 framework 2, in one instance.
secondly MS Access 2003 and VS.Net 2005 for another installation. How much hard disk space i need for these installations and how much RAM, and processor is required for the same.
Please help me on this asap.
# June 3, 2006 4:32 AM

Amit said:

Also in context to my above mentioned query, im talking in pretext of client side installation where i just need to install only framework 2 in one machine (for which i need to know the Hardware requirement) and SQL server 2000 with VS.Net 2005 on another madhine (again for which i need to know hardware requirements).
# June 3, 2006 6:00 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

Our Sponsors

Free Tech Publications

This Blog

Syndication

News