Multi-targeting with Visual Studio 2008

Over of the perhaps over hyped features of Visual Studio 2008 is the ability to create, or work with existing, .NET Framework v2.0 applications.  One of the pain points of previous upgrades to Visual Studio is the need to migrate to a compatible version of the .NET Framework.  For large applications this can be a time consuming process to not only upgrade the codebase but also ensure that no functionality has been broken.  Unfortunately whilst it would be great for Microsoft to provide a perfect upgrade wizard that would guarantee that no bugs are introduced, the reality is that this is not practical and as such many organisations decide to defer the upgrade until a suitable break in their shipping cycle (for example after a major release). This has resulted in many organisations still working with .NET Framework v1.1 applications using Visual Studio 2003 – which is far from a current/productive IDE!

As part of a continuous movement by Microsoft to separate the framework from the IDE the next installment of Visual Studio, codename Orcas, allows developers to work on legacy applications whilst still taking advantage of the significant improvements in the IDE. This is something that mobile application developers have had with the compact framework since Visual Studio 2003 where we could build both v1 and v2 .NET Framework applications within the same IDE.

Last weekend when I was preparing to leave for Korea I extracted the latest source code from subversion to my personal laptop – thinking that I would take just the one laptop with me.  When I rebuilt this laptop I only put Visual Studio 2008 Beta 2 following the lead of a number of Microsofties and as a way of forcing myself to become familiar with the changes in preparation for writing the second edition of the Professional Visual Studio book.  I opened up one of our existing .NET Framework v2 solutions and got an ugly surprise when it prompted me to go through the upgrade wizard – upgrade? but I thought that I could continue to work with v2?  Not having the time to work out what it was going to do I decided that it would be best to take both laptops with me and it has taken me until now to go back and investigate.

This time I decided to proceed through the upgrade wizard, despite it not informing whether it was going to upgrade to v3 of the .NET Framework or whether it was just going to upgrade solution and project files. It also didn’t give me the option to backup the existing files, which I could have sworn was a feature of previous upgrade wizards. At the end of the wizard I checked the show log file option, revealing that the wizard does very little indeed.

image

From the conversion report it appears that both the solution file and all project files were converted.  However, the scan of all files contained in the project revealed that none of them needed to be upgraded.  I wonder if necessary upgrades are documented anywhere?  This will require further investigation when I’m not flying above the clouds and am back online.

Wanting to investigate this further I decided to do a diff and see what had been changed in the solution and project files.  Starting with the solution file it appears that only the header is upgraded:

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

This makes sense as it will ensure that the upgrade wizard isn’t run the next time I open the solution file but what happens when I open the solution in [VS2005]?  Again, further investigation required.

Now for the project files… It appears that there are a couple of additional attributes and elements that have been added to the project file (bold indicates additions):

<Project DefaultTargets=”Build” ToolsVersion=”3.5″>
<PropertyGroup>
  ….. {existing elements} ……
  <FileUpgradeFlags>
  </FileUpgradeFlags>
  <OldToolsVersion>2.0</OldToolsVersion>
  <UpgradeBackupLocation>
  </UpgradeBackupLocation>
</PropertyGroup>

Now I’m presuming that old versions of MSBuild will simply ignore these new attributes and elements? More investigation required to determine both what each of these tags means (other than the obvious) and whether there is any level of backward compatibility.

Clearly whilst this feature is a key selling point for upgrading to Visual Studio 2008 I think that unless Microsoft ensures backwards compatibility there will still be a number of organisations that hold off upgrading.

Leave a comment