London Calling

Ramblings of a software architect in London.

Monthly Archives: May 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!

.NET Settings Providers

I’m researching different methods of persisting, updating and managing configuration in .NET, as I’ve become a bit tired of rolling my own static “Config” class.

Having used the newer Settings architecture (as opposed to the old fashioned non-typed AppSettings) on a small scale site, I’ve been interested in how it might be possible to extend these over a distributed system.

Turns out you can, the system is pluggable.

Over the next few weeks I’ll be exploring how this might benefit an application – especially in the area of not having to restart when writing to app.config files!