Posted by: rcosic | 05/02/2009

Migration to Visual Studio 2008

I have just pass through this task and it seems to be very simple and practical.
So you want to migrate your (VS 2005) code to Visual Studio 2008 and want it now? No problem! Let’s go!

The simplest way to start with it is that you start the studio and open a project from here. When you pick a project and try to open it with new Visual Studio, it will prompt you with the migration wizard dialog, as you can see here:

The messages are straightforward and you practically do not have to do anything except to confirm that you want to convert it to the newer version. So, let’s do it!

If your solution is under source control, it will be automatically checked out, along with all the containing projects, and settings files, but, as you will see, the changes will be minor.

Let’s go down to one by one change for a second:

1. The solution file (*.sln) will be changed:
– only header of file is changed to:
Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008

2. The project files (*.csproj) will be changed:
– header is changed to:
Project DefaultTargets=”Build” xmlns=”http://schemas.microsoft.com/developer/msbuild/2003″ ToolsVersion=”3.5″>
– a couple of tags are added:
FileUpgradeFlags
OldToolsVersion -> 2.0
UpgradeBackupLocation

3. The settings files (Settings.Designer.cs) are changed:
– only SettingsSingleFileGenerator-Version is actualized (from 8.0.0.0 to 9.0.0.0)

Thanks to “multi-target” feature of Visual Studio 2008, we now have the chance to choose between .NET Framework on which to build our projects. Migration wizard will let us stay on 2.0, but we can change it any time by selecting the proper combobox option inside project properties, as you can see from the picture below:

Problems with the unit tests

You can step into one small problem if you have some unit tests already in function from Visual Studio 2005.
Alas, migration routine does not update the reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll correctly, and leaves the 8.0.0.0 which is apparently not available in VS 2008.
This brings you with some weird error when you try to fire some of the tests:

Method ….MyClassInitialize has wrong signature.
Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.

Only you have to do is to remove the reference from the unit test project and add it once again, but now with the correct version (9), as you can see from the picture. Now, build the project and the test should run as they did in VS 2005.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: