Friday, December 31, 2010

Upgrading to newer versions of Pex and Moles

I just recently started using Pex and Moles after reading about it on the Microsoft Visual Studio web site.  I have been searching for a Microsoft-endorsed method for creating Mock objects and it seems that Microsoft finally came to the rescue with Moles.  I had been reviewing the possible use of NMock, RhinoMocks, Moq or even TypeMock, but the documentation on the open source Mock frameworks was sparse and TypeMock was quite expensive.

If you are not already familiar with Pex and Moles, you can read more about them here:

You can download a combined installation of Pex and Moles through your MSDN Subscription or else Moles is available for individual download from the Visual Studio Gallery.

However, once I began using Pex and Moles for inclusion within my Unit Tests, the problem I started encountering was that there were new releases of Pex and Moles nearly every few weeks.  Therefore, each time I upgraded my installation of Pex and Moles, I would encounter problems with my builds because of the dependencies on the particular version of Moles that I incorporated into my Visual Studio Unit Tests.

Well, just by chance, I discovered the option to be able to upgrade all of my .Moles files within my solution.  Simply right-click on the solution file and select the menu option for "Upgrade .Moles files".

After using this option, I can now successfully upgrade my versions of Pex and Moles without worry!

Tuesday, December 28, 2010

Upgrading Team Foundation Server 2010 RTM Virtual Machine to Full Version

If you are like me, you probably wish to save yourself the time of installing and configuring a full virtual machine set up with Team Foundation Server 2010. 

Considering that a fully working and integrated VM for Team Foundation Server 2010 consists of installing Windows Server 2008, IIS, SQL Server 2008, Microsoft Office 2007 or above, Visual Studio 2010 Premium or Ultimate Edition and finally Team Foundation Server 2010, you can save yourself a lot of time and a lot of unnecessary hassle by simply downloading and utilizing the VMs that are pre-configured for you by Microsoft and available as a free download in VHD format.  The download formats are available for virtual platforms ranging from Virtual PC 2007 SP1 to Windows 7 Virtual PC to Hyper-V.

If you have not already downloaded the Team Foundation Server 2010 RTM Virtual Machine, you can download them from here:

For Windows 7 Virtual PC:
For Windows Server 2008 Hyper-V:
For Virtual PC 2007 SP1:

Once you have done that and launched the virtual machine, now you can begin the process of converting the virtual machine to full versions/full editions so that the virtual machine does not expie (by default the entire virtual machine is installed with evaluation editions which are set to expire after a certain period of time).

So, if you have an MSDN subscription (which most developers do), you should be able to enter new product keys for all of the various products and activate them respectively.

The product keys you will need to have available are the following:

  1. Windows Server 2008 Standard Edition
  2. Visual Studio 2010 Ultimate Edition
  3. SQL Server 2008 Enterprise Edition
  4. Microsoft Office 2007 Enterprise Edition
  5. Team Foundation Server 2010
The easiest piece to activate will be Microsoft Office 2007, so I will start with that first:

  1. Launch Microsoft Office Word 2007 (or another respective Office application)
  2. You will immediately be prompted for a product key
  3. Enter your Office 2007 Product Key
  4. After the product key has been successfully validated, click on the Install Now button
  5. Once the installation has completed, click on the Close button
Next, you can activate your copy of Windows Server 2008:

  1. Open the Control Panel
  2. Go to the System icon
  3. Click on the link for "Change product key"
  4. Enter your Windows Server 2008 product key
  5. Click Next to begin the process of activating your copy of Windows Server 2008
Now, upgrade your edition of SQL Server 2008:

  1. Insert the media (or mount the ISO image) for the SQL Server 2008 Enterprise installation
  2. Once the SQL Server Installation Center dialog pops up, click on the navigation link for Maintenance
  3. Click on the link for Edition Upgrade
  4. Click through the wizard dialogs until you reach the screen for "Select Instance"
  5. Select the MSSQLSERVER instance
  6. Click Next until you reach the "Ready to upgrade edition" dialog
  7. Click on Upgrade to proceed with the SQL Server edition upgrade
  8. Click Close once the upgrade has completed.
Now, upgrade Visual Studio 2010 Ultimate Edition:

  1. Mount the ISO image for Visual Studio 2010 Ultimate Edition from your MSDN subscription
  2. Browse to the Setup directory
  3. Open the file setup.sdb file in the text editor of your choice
  4. Look for an element named [Product Key]
  5. Beneath this element you will find the Product Key for your copy of Visual Studio 2010 Ultimate Edition
  6. Now open the copy of Visual Studio 2010 Ultimate Edition on your virtual machine
  7. From the Help menu, select Register Product
  8. Enter the Product Key that you copied from your setup.sdb file
Finally, upgrade your copy of Team Foundation Sever 2010:

  1. Mount the ISO image for Team Foundation Server from your MSDN subscription
  2. Browse to either the TFS-x64 or TFS-x86 directories
  3. Open the file setup.sdb file in the text editor of your choice
  4. Look for an element named [Product Key]
  5. Beneath this element you will find the Product Key for your copy of Team Foundation Server 2010
  6. Now open the Team Foundation Administration Console
  7. Look on the main Team Foundation Server Administration Screen
  8. Click on the link for Update License
  9. Enter the Product Key that you copied from your setup.sdb file
That should be it!  

You have now fully converted your evaluation version Team Foundation Server 2010 Virtual Machine to a fully functional virtual machine with no time limits or restrictions!

Sunday, December 26, 2010

Converting VHDs to use for VMWare

If you are like me, you probably prefer to use VMWare vs. using Virtual PC or Hyper-V.  I especially like VMWare Workstation because of the flexibility and capabilities it offers over its Microsoft counterparts.  However, building VMs is a very time consuming task, and I would just as soon use something already pre-configured for me.

Fortunately, the folks at Microsoft have done just that for us.  They have created numerous Microsoft server environments for us ranging from Windows Server 2008 to Exchange Server to SQL Server to even Team Foundation Server.  Of course, on the down side, all of these virtual machines are released in the Microsoft proprietary format of VHD.

But, thanks to our friends at VMWare, they have provided us with a solution to utilize these VHDs within VMWare Workstation.

So to get started, you will have to download a Microsoft VHD that you would like to use.  You can download numerous VHDs from here:

Next, you will need to install either VMWare Workstation or VMWare Converter from the VMWare website.  If you are going to be using VMWare Workstation, you can download the most current release (v. 7.13) from here:

If you are using Windows 7, you will then have to install Windows Virtual PC.  You can download it from here:

Once you have downloaded it and installed it, you should now have a menu item in your All Programs folder for Windows Virtual PC.  Beneath the Windows Virtual PC folder, click on the Windows Virtual PC icon.  (Optionally you can also search for Windows Virtual PC and the program should come right up)

Once you click on the icon, you should see a Windows Explorer window with several menu items including one that states "Create virtual machine".  You will want to click on this menu item to begin creating a new virtual machine.

Next, go through all of the standard screens for configuring a new virtual machine.  However, when you get to the screen for "Add a virtual hard disk", select the option for "Use an existing virtual hard disk" and browse to the VHD file that you downloaded earlier from the website.

Click on the Create button and the Windows Virtual PC machine should be created for you.

Now, you are finally ready to create the VHD for use within VMWare:

  1. Open VMWare Workstation
  2. From the File menu, select Import or Export
  3. Begin the Import wizard
  4. On the Source Type screen, select Other
  5. On the Virtual Machine screen, select the path to .vmc file created by Windows Virtual PC
  6. On the Source Data screen, choose the options for the VMWare Disk size.
  7. Proceed through the remaining screens until you reach the Ready to Complete screen.
  8. Click on the Finish button to begin the process of converting the Windows Virtual PC to the VMWare format.
  9. Once the conversion process is complete (this might take anywhere between 1/2 hr or longer), you should now be ready to open the virtual machine directly in VMWare Workstation!