次の方法で共有


Visual Studio 11 Developer Preview - Project Backward Compatibility (Round-Tripping)

 

[ NOTE:  This post has been depricated.  The new, updated post can be found here:

https://blogs.msdn.com/b/zainnab/archive/2012/06/05/visual-studio-2012-compatibility-aka-project-round-tripping.aspx ]

 

image

 

UPDATE 3/8/2012:  As of the Beta this does not work with all project types.  Most notably web projects are not supported currently for this feature.  For more information on what is supported and what isn't look here:

https://msdn.microsoft.com/en-us/library/hh266747(v=VS.110).aspx

 

Probably one of the most welcome new features in VS11DP is the new project backward compatibility feature also known as project round tripping.  Let’s dig into the details.

 

The Old Days

In all prior incarnations of Visual Studio if you had an older version, VS2008 for example, and opened up the project in a newer version, VS2010 in this case, you had the option to convert the project.  If you did the conversion it was a one-way trip.  You couldn’t open the project again in VS2008 if you tried to go back.  This has been the source of a lot of pain and suffering for developers who have to work with multiple versions of Visual Studio.  We want the cool features of the latest IDE but still want others on our team to be able to open the solution in the older version of Visual Studio when they get the files from source control.

 

The New, Happy Days

You can now create projects in Visual Studio 2010 with Service Pack 1 then open those projects in Visual Studio 11 Developer Preview and THEN open the project up again in VS2010SP1.  In other words, we now have full project round-tripping capability so you can work with the latest features but still keep the solution compatible with and older version of Visual Studio. 

 

Putting it to the Test

Here are the steps you can take to test this for yourself:

  1. Create a project with Visual Studio 2010 with Service Pack 1 and put in a little sample code.
  2. Save and close the solution.
  3. Open the solution (CTRL + SHIFT + O) in Visual Studio 11 Developer Preview and add some more code.  Notice there is no longer a prompt to convert the project that appears.
  4. Save the close the solution.
  5. Open the project up again in VS2010SP1 and bask in the glory of project round-tripping.

 

Limitations / Observations

  • I know this works with Visual Studio 2010 Service Pack 1 but haven’t tested VS2010 with out the service pack.  I believe it will not work unless you have the service pack but am checking with the team.
  • You can’t use this feature with versions older than VS2010.
  • When you use any feature specific to the new version of Visual Studio, like changing the Framework to the latest version, then the project cannot be opened in the prior version.  I just changed the framework version from 4.0 to 4.5 for a project and saved it without many any other change and was not able to open the solution in VS2010.

Comments

  • Anonymous
    November 08, 2011
    Also, round-tipping isn't supported for TF Database projects.  VS11 wants to convert our .dbproj files into a new format....

  • Anonymous
    November 08, 2011

  1. I can confirm you need the SP, I tried to open it in one VS without it. I am almost sure it's in the readme
  2. When I convert a big solution with solution folders, some projects are imported outside its folder.
  • Anonymous
    November 08, 2011
    Thanks Benjamin :) I talked to the VS team (Lisa F) the other day and the SP1 requirement is defintiely confirmed.  Not sure about the conversion issues as I haven't seen that problem yet. Z

  • Anonymous
    November 09, 2011
    and not supported on VS 2010 Architecture projects

  • Anonymous
    November 09, 2011
    I have been loving this feature since the developer release of VS11. I like to use some of the new features in VS11 while I still like to use VS2010 because I have all my add-ons and extensions setup and configured the way I like them. I'll usually open my solution in both VS' and then run the code duplication feature in VS11 then in VS2010 go into the code and make the changes necessary.

  • Anonymous
    November 16, 2011
    I'm guessing this is because VS11 is essentially VS10 with SP2.  It's great news, but I fear that when VS12 comes out, they'll break it.  At least we can enjoy it while it lasts.

  • Anonymous
    November 16, 2011
    Hey Dean :) I have to disagree that Dev11 is basically VS2010 SP2.  Certainly with each version we fix issues from the prior version but, given the large amount of new features added, this release will go far beyond that.  Just my .02 Z

  • Anonymous
    November 17, 2011
    @deadlydog Roundtripping is supported for database projects! Yes, you will need to upgrade your VS2010 Database Project (.dbproj) to a new format, which is the database project type of SQL Server Data Tools (.sqlproj). But from there, you can work with the same project again in VS2010 SP1 if you install SQL Server Data Tools (get it here: msdn.microsoft.com/.../hh297027). It's a free download released for VS2010 users and we are working toward RTW alongside SQL Server 2012, and are also in VS11. SSDT is the next evolution of the database projects you worked with in VS2010, format has changed and a lot of improvements have been made. There are a few things that are not quite supported yet in SSDT and thus won't be upgraded, like data generation plans or data comparison files. The upgrade will backup your VS2010 database project so you won't lose those files.

  • Anonymous
    March 01, 2012
    Hi! I've just installed VS11beta and tried to open my solution (.NET 3.5, last saved in VS2010SP1) and VS11 touched all project files (updated the OldTools-Version and other stuff) and the version number of the designer files. Is this a bug in the round-trip feature? Because this behavior makes it impossible to work as a team with different studio versions and stil maintain a sensible list of changes during commits. Regards, Michael

  • Anonymous
    March 06, 2012
    The comment has been removed

  • Anonymous
    March 06, 2012
    Michael / John, I'm looking into this with the team that works on this.  I'll work up an answer over the weekend and get back to this thread. Z

  • Anonymous
    March 07, 2012
    Thanks for the quick response zainnab. Looking forward to the feedback from the team over the weekend! And let me know if you could use some samples from the exact changes that appear. If you provide an e-mail address, I can send them to you.

  • Anonymous
    March 07, 2012
    Hey John :) Got some feedback from the team and they would like to know what types of projects you are seeing updated since not all project types are supported so far for this feature.  For example, if all the projects were web projects, then it’s expected for them to be checked out. I need to know the project type in order to know whether the modifications are justified or if we have a bug.   Z

  • Anonymous
    March 08, 2012
    Hi Zain! Thanks for the repsonse. Yes, I can confirm that it's only web-projects. I completly missed this the first time since I got overloaded with changed files list. I'm sorry about that (BTW, the async solution load is awesome in large solutions!) I did a thorough analysis now and here's what I've found. (I matches your statement and is actually better than that :) ). I can confirm that only it touches Web Application projects (C# and VB). Here's the affected file types:

  1. The project file: Here's the contents of a patch file. I hope it comes out OK. As you can see, opening the project added some stuff and changed the old tool's version. A more detailed analysis shows that it's actually safe to commit the changes. VS2010 won't try to revert them to the old format, even when editing the project (e.g. adding a file). So, I guess, it's just a one time compatibility impact. Index: Web.csproj =================================================================== --- Web.csproj (revision 22532) +++ Web.csproj (working copy) @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="schemas.microsoft.com/.../2003" ToolsVersion="4.0">
  •  <Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props')" />   <PropertyGroup>     <ProductVersion>9.0.30729</ProductVersion>     <SchemaVersion>2.0</SchemaVersion> @@ -29,7 +30,7 @@     </FileUpgradeFlags>     <UpgradeBackupLocation>     </UpgradeBackupLocation>
  •    <OldToolsVersion>3.5</OldToolsVersion>
  •    <OldToolsVersion>4.0</OldToolsVersion>     <SignAssembly>true</SignAssembly>     <AssemblyOriginatorKeyFile>......key.snk</AssemblyOriginatorKeyFile>     <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> @@ -382,6 +383,10 @@   <ItemGroup>     <Folder Include="Res" />   </ItemGroup>
  •  <PropertyGroup>
  •    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
  •    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)MicrosoftVisualStudiov$(VisualStudioVersion)</VSToolsPath>
  •  </PropertyGroup>   <Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />   <PropertyGroup>     <PreBuildEvent> @@ -407,5 +412,6 @@       </FlavorProperties>     </VisualStudio>   </ProjectExtensions>
  •  <Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudiov10.0WebApplicationsMicrosoft.WebApplication.targets" />
  •  <Import Project="$(VSToolsPath)WebApplicationsMicrosoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
  •  <Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudiov10.0WebApplicationsMicrosoft.WebApplication.targets" Condition="false" /> </Project> No newline at end of file
  1. Resource and Settings designer files: Apparently, here, too, only Web-Application project designer-files for Resources, Settings, etc are affected. It touches the Runtime Version in the header section. A test showed, opening the resource with VS 2010 doesn't revert the change, which is good. So, this leaves only one real issue: When you're actually editing the resources in VS2010, the new Runtime Version gets set. And when you then oven it in VS 11, it would touch the file once more. For me, that's a compromise I can live with, since I don't have that many resources in the solution I'd be developing with both VS version. Index: Resources.Designer.cs =================================================================== --- Resources.Designer.cs (revision 22532) +++ Resources.Designer.cs (working copy) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // <auto-generated> //     This code was generated by a tool. -//     Runtime Version:4.0.30319.1 +//     Runtime Version:4.0.30319.17379 // //     Changes to this file may cause incorrect behavior and will be lost if //     the code is regenerated.
  2.  ASPX-designer files. Also, the header in ASPX-designer files only gets touched by VS 11 when you edit the markup. And then VS2010 does not touch this new header at all. Which is great! Sorry, again, for the confusion. Regards, Michael
  • Anonymous
    March 08, 2012
    Michael :) Thanks for the update.  I'm glad you asked the questions as it clarified the feature for me as well.  :)  I'll let the team know all is well. Z

  • Anonymous
    April 03, 2012
    Hi, Just installed the beta, the startup page throws a XAML error. Should I be able to open VS2008 & 2010 projects in VS11 beta? I can't on the ones I've tried.

  • Anonymous
    May 14, 2012
    I have vs 2011 Ultimate Beta SLN but can not open same SLN in VS2010 Sp1. ALthough cs.proj project file can be opened in vs2010 but need to chg .net framework from 4.5 to 4.0; Can any one help open same SLN created in Vs2011 in vs 2010? THX

  • Anonymous
    May 14, 2012
    What projects do you have in the solution?  Not all project types are supported yet.

  • Anonymous
    May 14, 2012
    Console Application in VS2011 Ultimate Beta. and need to open Sln in VS2010sp1; Thx

  • Anonymous
    May 14, 2012
    Ahhh.  I see the issue.  Okay let me break it down:

  1.  If you start a project/solution in VS2010SP1 it will open in VS11 without making changes that prevent you from re-opening it in VS2010SP1.  So full round tripping is supported.
  2.  If you start a project/solution in VS11 it will NOT open in VS2010SP1 due to the changes in the proj/sln files.  To my knowledge there is no setting to indicate you are going to go back to a prior version of VS that would prevent the new proj/sln type from being used. So the project round trip feature is a forward-only activity today.  I'm not sure it will change or what the plans are for multiple versions going forward.  I suspect as we keep doing this feature that, much like the Framework, you will be able to go back and forth a bit more but that is just a guess.
  • Anonymous
    May 14, 2012
    Thanks for the update, Sir! Very much appreciated.