Tuesday, June 1, 2010

Downgrading VS2008 Solution or Projects to VS2005 - manually by changing XML

Yesterday, I got stucked in a situation where I have to downgrade an existing VS2008 project to VS2005 one. I was thinking it was an easy job. Yes it is... but in case if you have VS 2005 installed otherwise its going to be a messy day, without VS2005.
I did researched a lot on google. Viewed VS 2005 project and VS2008 project and solution files in notepad and found the following difference that will help you in downgrading the project/solution manually. Lets see what are they.


1. VS 2008 Solution File(.sln) (XML):
                 // First line is a blank line do not delete it
Microsoft Visual Studio Solution File, Format Version 10.00 // your vs version
# Visual Studio 2008 // IDE
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JabilDemo", "JabilDemo\JabilDemo.csproj", "{22E03101-7132-44CF-8246-C13E10460C45}" // Project in this solution and Its GUID
EndProject // end of project
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution // building options
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{22E03101-7132-44CF-8246-C13E10460C45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22E03101-7132-44CF-8246-C13E10460C45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22E03101-7132-44CF-8246-C13E10460C45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22E03101-7132-44CF-8246-C13E10460C45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal


2. VS 2005 Solution File(.sln) (XML):


Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JabilDemo", "JabilDemo\JabilDemo.csproj", "{22E03101-7132-44CF-8246-C13E10460C45}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{22E03101-7132-44CF-8246-C13E10460C45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22E03101-7132-44CF-8246-C13E10460C45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22E03101-7132-44CF-8246-C13E10460C45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22E03101-7132-44CF-8246-C13E10460C45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal


The difference between the two solution files is the first two lines last words.
One is 10.0 and 2008, and another is 9.0 and 2005. So, VS 2008 solution file conversion is pretty easy. Huh!!!! No more pain. Small change in first two lines. Rest will be same.


Now come to the messy one Project Files:


3. VS 2008 Project File to VS 2005 Project File (.csproj/.vbproj) (XML): I am using project file of a web application in c#. Open the project file in editor like Notepad or Notepad++. Search for the following tags:
VS2008                                                                                                                      VS2005
<ProductVersion>9.0.30729ProductVersion><ProductVersion>8.0.50727ProductVersion>
 <TargetFrameworkVersion>v3.5TargetFrameworkVersion> <TargetFrameworkVersion>v2.0TargetFrameworkVersion>


DataSetExtensions">
      <RequiredTargetFramework>3.5RequiredTargetFramework>
    
NA




      <RequiredTargetFramework>3.5RequiredTargetFramework>
    
    Xml.Linq">
      <RequiredTargetFramework>3.5RequiredTargetFramework>
    
NA
MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\
WebApplications\Microsoft.WebApplication.targets" />
 na


If you replace the VS2008 tags with VS2005 one it will work. But before that be sure to make a copy (backup) of your working files. May be this trick will throw in some more gluey situtaion....


NA above means just remove the tags without leaving any blank line in between the tags.


If you want to do it using tool , you can find it below in my skydrive. 

No comments:

Post a Comment