Share via


How to use solutions and projects between Visual Studio 2005 and 2008

In this blog post, I’ll explain the possibilities and limitations of using solutions and projects between Visual Studio 2005 and 2008.  Read on!

The upcoming release of Visual Studio 2008 introduces a great new feature called ”.NET Framework Multi-targeting” that allows you to target multiple versions of the .NET framework using Visual Studio 2008. (Check out Luke Hoban’s blog and Scott Guthrie’s blog for additional information)  Multi-targeting opens up a new world of possibilities, in addition to its fair share of questions.  One particular question that we’ve been hearing often over the past few months is: “How can I work with solutions and projects between Visual Studio 2005 and Visual Studio 2008?”

The short answer to this question is:

  1. Solutions created in Visual Studio 2008 cannot be opened in Visual Studio 2005
  2. Projects created in Visual Studio 2008 can be opened in Visual Studio 2005
  3. Solutions and projects created in Visual Studio 2005 can be opened in Visual Studio 2008

As with all things, there are some subtle details with these statements that I’d like to take some time to explore with you. 

Solutions created in VS2008 cannot be opened in VS2005

As you work with multi-targeting, you or your team may have a need to share solutions between Visual Studio 2005 and Visual Studio 2008.  One common scenario would be opening a solution created in Visual Studio 2008 and targeting .NET Framework 2.0 in Visual Studio 2005.  You’ll find that opening this solution in Visual Studio 2005 will give you the following error dialog.

clip_image001

      Diagram 1: Error message when opening VS2008 solution in VS2005

This dialog demonstrates an important point: Opening Visual Studio 2008 solutions in Visual Studio 2005 is not supported at the solution level.   This is triggered by the fact that the version number in the .sln file of any solution created in or upgraded to Visual Studio 2008 has been updated to 10.00 (see Diagram 2).  This was a tough decision that we had to take during the design of Visual Studio 2008 and was due to the enormous complexity and cost of supporting the resulting compatibility scenarios.  This is an area that we will be actively investigating to improve for our next release.

Visual Studio 2005 Visual Studio 2008

Microsoft Visual Studio Solution File, Format Version 9.00# Visual Studio 2005

Microsoft Visual Studio Solution File, Format Version 10.00# Visual Studio 2008

       Diagram 2: Comparison of .sln files between VS2005 and VS2008

Are there any workarounds?

If you’re daring, there are a few things that you can do to work around this restriction.  Given that these scenarios are not supported, going down these routes may cause your project items to become corrupt, designer elements to break, etc. so please keep these risks in mind. 

  1. The first workaround is a rather obvious one that you may have already tried.  It involves modifying the version of the Visual Studio 2008 .sln file to 9.00.  You’ll find that in most cases, this will do the trick and allow Visual Studio 2005 to open the solution.  However, if the solution contains any projects and/or settings that are new to Visual Studio 2008 (i.e. usage of new language constructs, designer interfaces, etc.), the solution can fall apart. I would encourage you to not use this workaround, especially for solutions that contain several projects.

  2. The second work around involves adding projects created in Visual Studio 2008 directly into an existing Visual Studio 2005 solution.  The important point to note here is that Visual Studio 2008 projects are not explicitly blocked from being opened/added to Visual Studio 2005 solutions. The motivation behind this decision was to ensure that Visual Studio would remain performant by avoiding the performance hit of checking the versioning of every single project in a solution on startup.  This workaround has similar risks as the first workaround, but given that it forces you to make a targeted decision as to which project to use in the Visual Studio 2005 solution, it may be a viable workaround for you.

A note about the ToolsVersion attribute

For both of the workarounds above, you can update the project files (.csproj, .vbproj, etc.) to control the version of the build tools that will be used. This is done through the ToolsVersion attribute on the Project element. Diagram 3 describes the change that needs to be made in order for a project created in Visual Studio 2008 to invoke the 2.0 version of the build tools.

Original .csproj Modified .csproj

<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns= "https://schemas.microsoft.com/ developer/msbuild/2003">

<Project ToolsVersion="2.0" DefaultTargets="Build" xmlns= "https://schemas.microsoft.com/ developer/msbuild/2003">

                     Diagram 3: How to update the build toolset

Solutions and projects created in VS2005 can be opened in VS2008

It's worth mentioning that when opening a Visual Studio 2005 solution or project in Visual Studio 2008, you will see a dialog that will guide you through the upgrade process.  The important thing to keep in mind is that this process will update the version number in the .sln file to 10.00, which will prevent this solution from being opened again in Visual Studio 2005.  Note that all of the points discussed in this post apply to these upgraded solutions and projects as well. 

Closing Thoughts

As always, I’d love to hear your feedback and questions.  I expect there to be some confusion on this topic so feel free to add your comments.  Also, if you happen to run into any issues while trying out different scenarios involving solution/project inter-operability between Visual Studio 2005 and 2008, file a bug on the Connect website.

Comments

  • Anonymous
    November 06, 2007
    PingBack from http://msdnrss.thecoderblogs.com/2007/11/07/how-to-use-solutions-and-projects-between-visual-studio-2005-and-2008/

  • Anonymous
    November 08, 2007
    I thought I'd get away with maintaining both a vs2005 solution file and a vs2008 solution file and sharing projects but I found a few more problems: Sharing a VS Test project between a PC with only VS2005 and a PC with only VS2008 will mean changing the QualityTools.UnitTestFramework reference regularly. Similarly with sharing Web App and DBPro projects between these machines. We've decided that for anything more than simple Win Forms + Class Library solutions we will just make sure everyone on the team is using VS2008.

  • Anonymous
    November 21, 2007
    With VS 2008 being released on Monday , let the project conversions begin! While I wish we could have

  • Anonymous
    December 30, 2007
    The comment has been removed

  • Anonymous
    January 05, 2008
    I guess you guys had no choice, but to upgrade an enterprize team of 40 onshore and 100+ offshore members is NOT easy. Not many managers give the members enough time to settle down and upgrade IDEs when they should be writing code. There has to be a solution to the problem of sharing .sln and .proj files between IDEs. Let me know if you have any ideas. The alternatives of manually changing version nos. in sln files are too risky to try. Thanks, Rupak Ganguly Solution Architect, Hewlett Packard

  • Anonymous
    January 08, 2008
    The comment has been removed

  • Anonymous
    January 10, 2008
    This is great stuff!  Thanks for the info!

  • Anonymous
    January 10, 2008
    DJPark has written a great article on transferring and sharing Visual Studio projects between 2005 and

  • Anonymous
    January 17, 2008
    The comment has been removed

  • Anonymous
    January 17, 2008
    Ok, now here is what I found further:

  1. If the project is created in VS2005, upgraded with VS2008 (it seems the upgrade report shows that no changes have been made to the project) - then this project can be opened in VS2005 back again without any errors as mentioned in my previous post.
  2. If the project is created in VS2008 and then opened in VS2005, the error mentioned above is seen. Thanks, Rupak Ganguly Solution Architect, Hewlett Packard
  • Anonymous
    January 17, 2008
    On further investigation: VS2008 DOES change the project file when upgrading the VS2005 project. Here are the changes:
  1. Old: <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">">http://schemas.microsoft.com/developer/msbuild/2003"> New: <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> This ToolsVersion controls the version for the build tools that are invoked.
  2. Old: Not present New:    <FileUpgradeFlags>    </FileUpgradeFlags>    <OldToolsVersion>2.0</OldToolsVersion>    <UpgradeBackupLocation>    </UpgradeBackupLocation> Note: I guess left over from the upgrade process. But, notice the OldToolsVersion.
  3. Old: <Import Project="$(MSBuildExtensionsPath)MicrosoftVisualStudiov8.0WebApplicationsMicrosoft.WebApplication.targets" /> New:   <Import Project="$(MSBuildExtensionsPath)MicrosoftVisualStudiov9.0WebApplicationsMicrosoft.WebApplication.targets" Condition="" /> Note the version no. change. Thanks, Rupak Ganguly Solution Architect, Hewlett Packard
  • Anonymous
    January 18, 2008
    Can you please confirm my understanding about something: It seems that it should be possible to have two different .sln files (one for VS2005 and one for VS2008) that share the .csproj files, and use one .sln if opening from VS2005 and the other from VS2008.  The only thing is, if you change the .sln in one (e.g. add a new CSPROJ) you would have to add it to the other yourself.  But, if the .csproj files are compatible, then for example adding a reference to a .csproj would mean it got seen by the other solution.  Correct?

  • Anonymous
    February 05, 2008
    Hey this sounds really helpful...let met try these options and see which one works out best... I have a vs2008  solution having 10 projects needed to be converted in vs2005... i have team of 30 people who are waiting for some easier way to migrate...so it would be great if any of these options works....

  • Anonymous
    February 19, 2008
    The comment has been removed

  • Anonymous
    February 27, 2008
    The comment has been removed

  • Anonymous
    March 23, 2008
    Thank you guys, I had big problem on this.

  • Anonymous
    March 29, 2008
    The comment has been removed

  • Anonymous
    April 06, 2008
    The comment has been removed

  • Anonymous
    April 18, 2008
    During the Heroes Happen Here events, I received a fair amount of questions regarding the combine use

  • Anonymous
    April 18, 2008
    ASP.NET 2.0 Guest Book - VS 2008 on Vista

  • Anonymous
    April 21, 2008
    How to use solutions and projects across VS 2005 and 2008

  • Anonymous
    July 09, 2008
    Notes on upgrading to Visual Studio 2008 from VS2005

  • Anonymous
    October 07, 2008
    I have same same troubles so, afetr below change in csproj file my VS2008 project can be compiled in VS2005 So, here we are before my change:  <Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" /> after my change:  <Import Project="$(MSBuildBinPath).Microsoft.CSharp.targets" /> and it works. thx

  • Anonymous
    October 18, 2008
    The comment has been removed

  • Anonymous
    January 07, 2009
    The comment has been removed

  • Anonymous
    January 19, 2009
    FYI on C++ projects: The schema can be found in c:Program FilesMicrosoft Visual Studio 9.0VCvcpackagesVCProjectEngine.dll as a resource. Search for <xs:enumeration value="7.00" /> in plain text (not unicode) If you want to force opening the new projects, edit the schema with a resource editor.

  • Anonymous
    March 13, 2009
    The comment has been removed

  • Anonymous
    April 09, 2009
    Web deployment to the local IIS server is no longer supported. The Web Deployment build tool has been removed from your project settings. This application has been updated to include settings related to the User Account Control (UAC) feature of Windows Vista. By default, when run on Windows Vista with UAC enabled, this application is marked to run with the same privileges as the process that launched it. This marking also disables the application from running with virtualization. You can change UAC related settings from the Property Pages of the project.

  • Anonymous
    April 09, 2009
    Hi, i got this error while importing  vc.net project from vs2005 to vs2008::: Web deployment to the local IIS server is no longer supported. The Web Deployment build tool has been removed from your project settings. This application has been updated to include settings related to the User Account Control (UAC) feature of Windows Vista. By default, when run on Windows Vista with UAC enabled, this application is marked to run with the same privileges as the process that launched it. This marking also disables the application from running with virtualization. You can change UAC related settings from the Property Pages of the project.

  • Anonymous
    May 24, 2009
    Hi This is great article. I had a problem to open VS 2008 project in VS 2005, it was showing me "Unable to read the project file 'ClassLibrary1.csproj'. D:ProjectsClassLibrary1'ClassLibrary1.csproj(42,11): The imported project "D:Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk." I changed my project properties file with the following attributes:

  1. Change <Project ToolsVersion="3.5" to <Project   ToolsVersion="2.0"
  2. Change <Import Project="$(MSBuildExtensionsPath)MicrosoftVisualStudiov9.0WebApplicationsMicrosoft.WebApplication.targets" /> to <Import Project="$(MSBuildExtensionsPath)MicrosoftVisualStudiov8.0WebApplicationsMicrosoft.WebApplication.targets" /> Now I can open my project with VS2005
  • Anonymous
    June 28, 2009
    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 <srcFile> <destFile>");            Console.WriteLine("eg. ");            Console.WriteLine("    VS2008ToVS2005 stuff_2k8.csproj stuff_2k5.csproj ");        }    } }

  • Anonymous
    July 14, 2009
    Thanks for the info. Catherine Sea www.dynamsoft.com www.scmsoftwareconfigurationmanagement.com

  • Anonymous
    September 04, 2009
    I'm SSSSOOOOOOooooo TIRED of Microsoft compatibility issues. No wonder Gates is one of the richest people in the world.  What a piece of SH!!!!T.

  • Anonymous
    November 01, 2009
    Also dont forget to modify the following in .csproj file:  <Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" /> TO  <Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />

  • Anonymous
    November 02, 2009
    Hi, I'm getting following warning after converting from Visual studio 2005 to 2008: Conversion Issues - setup.vcproj: Web deployment to the local IIS server is no longer supported. The Web Deployment build tool has been removed from your project settings. Project upgraded successfully. This application has been updated to include settings related to the User Account Control (UAC) feature of Windows Vista. By default, when run on Windows Vista with UAC enabled, this application is marked to run with the same privileges as the process that launched it. This marking also disables the application from running with virtualization. You can change UAC related settings from the Property Pages of the project. Please let me know is this breaks anything. Thanks for your reply. Daya

  • Anonymous
    December 10, 2009
    We have a VS 2008 Sharepoint project, including use of workflows. I need to "migrate" this to VS2005, since my customer doesnt have 2008 :( Can you please provide some urgent pointers on whether this will work, and what I can do to make it work?

  • Anonymous
    January 04, 2010
    I had to convert a C++ project from VS2008 back to VS2005. This solution worked for me: http://sourceforge.net/projects/vspc/

  • Anonymous
    February 18, 2010
    Thanks for the post!!! It helped me a lot!! I almost had a headache!

  • Anonymous
    March 09, 2010
    Thank, for the Good and detailed explanation, i've tested and it works Regards

  • Anonymous
    July 15, 2010
    There was a relatively simpler solution while opening 2008 solution in 2005. Just rename current whatver.vcproj to whatever.vcprok.vc2008.old and there will be a whatever.vcproj.8.00.old in the same directory. Rename that to whatever.vcproj. That's it! Then open up the solution, say ok ok ok  if any errors pop up and finally your soution explorer will appear with your projects all grayed out. Right click each project and reload each one manually. Simple enuf!

  • Anonymous
    November 19, 2010
    some another stuff: austincodecamp08.googlecode.com/.../Visual%20Studio%202005%20and%202008%20coexistence looks like writing project conventer was not something impossible, microsoft could do it..

  • Anonymous
    December 10, 2010
    i got this tool from softpedia :D www.softpedia.com/.../VSDownGrader-Download-161323.html