Upgrading a project from Visual Studio 2005 to Visual Studio 2008

While Visual Studio 2008 supports multi-targeting, sadly you are still required to convert the solution into the 2008 version.  I will briefly discuss how to convert a existing project from 2005 to 2008.

Visual Studio 2005 ASP.net 2.0 Website

To start with, I will discuss how to convert an ASP.net website. I’ve got an existing C# website stored on my file system which just containing a single Default.aspx page saying “This is a Visual Studio 2005 website.” (I didn’t get very far with it).

If we load Visual Studio 2008 (Beta 2) and select File > Open > Website and select the 2005 Project.  When we click open a dialog will be displayed

.NET Framework 2.0 Web Site Found

Clicking yes will load the website and add System.Core and System.Xml.Linq (not System.Data.Linq, you will need to add this manually yourself) and targeted for the .Net Framework 3.5.

Visual Studio 2005 Solution

For all other solutions, including ASP.net 2.0 solutions, when you load the project solution (File > Open > Solution) you will be represented with the conversion wizard, the same one as used when converting 2003 to 2005.

Visual Studio Conversion Wizard 

Visual Studio Conversion Wizard (2)

Visual Studio Conversion Wizard (3)

Visual Studio Conversion Wizard (4)

 Upon clicking close, your project will be loaded. However, it will still act and behave as a 2.0 application and still compile under the 2.0 framework.

2005WinFormApplication - Microsoft Visual Studio

Inside the actual solution file, the version text changes from

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005

to

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008

Because of this, when you try and load the project again in Visual Studio 2005 you will be given the following error message.

Microsoft Visual Studio

In order to add Linq functionality to the application you need to convert it to a .Net 3.5 application.  First, you need to change the Target Framework to .Net Framework 3.5 and then add references to the System.core.dll assembly.  In order to use Linq to SQL you will need to add System.Data.Linq.dll and for Linq to XML you will need to use System.Xml.Linq.dll.

Technorati Tags:

One thought on “Upgrading a project from Visual Studio 2005 to Visual Studio 2008”

Leave a Reply

Your email address will not be published. Required fields are marked *