Downgrade a VS 2008 .sln or .csproj to VS 2005
I just had to convert a Visual Studio 2008 Solution and Project to Visual Studio 2005, because we had to exchange sources with somebody who did not use VS 2008 yet.
Even though Microsoft (of course
) did not provide a wizard or automated tool for it, converting the solution is possible to do, if you know what you are doing. It is actually pretty straight forward. At least in my case... I really can't tell if it is always that easy.
All I had to do in the .sln file:
change
- Microsoft Visual Studio Solution File, Format Version 10.00
to
- Microsoft Visual Studio Solution File, Format Version 9.00
The .csproj is more complicated (showing changes as diff):
- +++ C:/vsone/source/SoundEx.the/SoundEx.the/SoundEx.the.csproj.2005
- --- C:/vsone/source/SoundEx.the/SoundEx.the/SoundEx.the.csproj.2008
- @@ -1,14 +1,17 @@
- +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- -<?xml version="1.0" encoding="utf-8"?>
- -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- + <ProductVersion>8.0.50727</ProductVersion>
- - <ProductVersion>9.0.21022</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{94E2C393-2BE5-411C-BAFF-892F2C049E06}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>SoundEx.the</RootNamespace>
- <AssemblyName>SoundEx.the</AssemblyName>
- - <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
- - <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- @@ -44,7 +47,7 @@
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="SoundexSystem.cs" />
- </ItemGroup>
- + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
The "-" at the start of a line means remove from 2008 version and a "+" means add to 2005 version. For more explanation see Diff Section "unified format".
Hope this helps in case you need to do the same.

Hmmm. Useful! I guess converting .csproj files from another project type than Library will have other challenges.
Thanks!
Comment on February 26, 2008 @ 15:12:08
Tobi,
I had to worry about the same thing where I work. We have a source control project in VS2005 and the people here weren’t too thrilled to switch to VS2008 if it meant that everyone had to switch at the same time.
Thanks for the info above. The SLN file was indeed found to be incompatible. PRJ files and Typed Datasets went through some conversions too. But these were found to be compatible with VS2005.
Hope Microsoft can fully appreciate the difficulties developers can face when trying to introduce new Versions of Visual Studio. They did a much better job this time. But it’s funny how even very small items can become “show-stoppers” in an environment using the latest software that they are licensed for.
Comment on February 26, 2008 @ 17:26:23
I’ve got a ProjectConveter utility that will convert solution files between VS2005 and VS2008: http://home.hot.rr.com/graye/Articles/ProjectConverter.htm
Comment on April 19, 2008 @ 15:38:31
The project converter posted by graye works like a charm.
Comment on October 28, 2008 @ 03:13:15
[...] : > devo seguire qualche accorgimento? esportare/salvare in qualche modo > particoalre? http://saftsack.fs.uni-bayreuth.de/~…ution/139.html — Lorenzo Barbieri Developer Evangelist – Microsoft Italia Blog: http://www.geniodelmale.info [...]
Pingback on January 17, 2009 @ 22:45:47
[...] http://saftsack.fs.uni-bayreuth.de/~dun3/archives/downgrade-vs-2008-sln-or-csproj-to-vs-2005-project... Blogroll [...]
Pingback on April 14, 2009 @ 05:33:13
A small tool to allow you to covert your projects…
I added it as a post build event to my vs2008 project
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
namespace VS2008ToVS2005
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 2)
{
if (File.Exists(args[0]))
{
XmlNamespaceManager nameSpaceManager = null;
XmlDocument doc = new XmlDocument();
doc.Load(args[0]);
nameSpaceManager = new XmlNamespaceManager(doc.NameTable);
nameSpaceManager.AddNamespace(“msb”, @”http://schemas.microsoft.com/developer/msbuild/2003″);
//<Project ToolsVersion=”3.5″
XmlElement el = doc.SelectSingleNode(@”//msb:ProductVersion”,nameSpaceManager) as XmlElement;
if (el != null && el.InnerText == @”9.0.30729″)
{
el.InnerText = @”8.0.50727″;
}
el = doc.SelectSingleNode(@”//msb:Project”, nameSpaceManager) as XmlElement;
if (el != null && el.Attributes["ToolsVersion"] != null)
{
el.Attributes.Remove(el.Attributes["ToolsVersion"]);
}
el = doc.SelectSingleNode(@”//msb:Import”, nameSpaceManager) as XmlElement;
if(el != null && el.Attributes[@"Project"] != null)
{
el.Attributes["Project"].InnerText = @”$(MSBuildBinPath)\Microsoft.CSharp.targets”;
}
if (File.Exists(args[1]))
{
File.Delete(args[1]);
}
doc.Save(args[1]);
return;
}
}
Console.WriteLine(“Usage :”);
Console.WriteLine(“VS2008ToVS2005 “);
Console.WriteLine(“eg. “);
Console.WriteLine(” VS2008ToVS2005 stuff_2k8.csproj stuff_2k5.csproj “);
}
}
}
Comment on June 29, 2009 @ 09:07:26
Firstly, change the “Target Framework” property from the 2009 proj properties. Then compiled the 2009 proj and fix issues id any (i.e. mostly issues related to the dataset xsd representing the database) – it can be solved easily by refreshing and rebinding it.
Then create a new 2005 proj and paste the whole 2009 proj (except the .csproj and .sln) file in to the directory of 2005 proj. From the solution explorer – click “Show all items” and then include everything into your proj. For the dataset xsd mapping the database – you might have to remap the database. Clean the solution and recompile it.
bingo .. its done ! hope this helps
Comment on July 28, 2009 @ 17:25:25
thanks! works fine!
Comment on July 30, 2009 @ 17:16:56
Just had to use your advice, and discovered another incompatibility – in code. The shortcut property syntax (public int someProp { get; set; }) doesn’t compile in VS 2005. Thought I mention this for whoever is interested.
Completely off topic: did you know there is a Toby Sharp at MS? Your T# made me look for T#, Tobi sharp, Tsharp, so I finally found him here: http://research.microsoft.com/en-us/people/tsharp/
Comment on October 26, 2009 @ 20:49:20