London Calling

Ramblings of a software architect in London.

Tag Archive for vsnet-2010

Using VS.NET web application projects with both VS.NET 2008 and 2010 RTM

What a palaver. Prior to RTM you could use VS.NET 2008 and 2010 web application projects alongside each other with no issues (after having 2010 upgrade them). With RTM, you get horrible issues with the line:

<Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudio
    v10.0WebApplicationsMicrosoft.WebApplication.targets" />

Added to the bottom of your .csproj files. After much soul searching I’ve found a solution with a bit of MSBuild cleverness. Turns out you can conditioanlly include MSBuild targets depending on the version of Visual Studio being used.

So, for each web application project in your solution:

  1. a) Have VS.NET 2010 upgrade your projects to the newer version.
  2. b) Replace the above line with:
<Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudio
    Condition="'$(Solutions.VSVersion)' == '9.0'" /> <Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudio     v10.0WebApplicationsMicrosoft.WebApplication.targets"
    Condition="'$(Solutions.VSVersion)' == '10.0'" />
  1. c) Blank out <FileUpgradeFlags></FileUpgradeFlags> which VS.NET 2010 has probably put “4.0” in, this will trip 2008 up otherwise.
  2. d) Blank out <UpgradeBackupLocation></UpgradeBackupLocation> in the same manner.

As long as you can then live with working with a seperate solution file for VS.NET 2010, you should be away and can stop annoying anyone else working on your files!