Visual Studio 2012 New Features: Compatibility (aka Project Round-Tripping)
Now that Visual Studio 2012 is pretty well baked I thought it would be good to start revisiting some of my favorite features again and introduce new ones. Since project round-tripping is one of my most favorite features I thought we would start with it.
The Dark Ages
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 for a long, long time. 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 Information Age
Visual Studio 2012 changes the game. You can now create projects in Visual Studio 2010 with Service Pack 1 then open those projects in Visual Studio 2012 and THEN open the project up again in VS2010 SP1. This works the other way, too! You can create projects in VS2012 (targeting Framework version 4 or less) then open the project in VS2010 SP1 and THEN open it up in VS2012 again. In other words, we now have project round-tripping capability so you can work with the latest features but still keep the solution compatible with team members using an older version of Visual Studio.
Putting it to the Test
Here are the steps you can take to test this for yourself:
- Create a compatible project (see fine print below) in Visual Studio 2010 with Service Pack 1 and put in a little sample code.
- Save and close the solution.
- Open the solution (CTRL + SHIFT + O) in Visual Studio 2012 and add some more code. Notice there is no longer a prompt to convert the project that appears.
- Save the close the solution.
- Open the project up again in VS2010 SP1 and enjoy project round-tripping.
The Fine Print
As you probably guessed by now this doesn’t work with every project type and there are some limitations based on the project type you use. For the full list of project types and limitations you can go here:
http://msdn.microsoft.com/en-us/library/hh266747(VS.110).aspx
Here is an edited list of the ones you are most likely to use:
Type of Project |
Compatibility | ||
---|---|---|---|
C#/Visual Basic Silverlight 4 or 5 Application or Class Library |
If you allow Visual Studio to update the project automatically, you can open it in either Visual Studio 2012 RC or Visual Studio 2010 with SP1. |
||
C#/Visual Basic Webform or Winform |
You can open the project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. |
||
Coded UI test |
If you allow Visual Studio to update the project automatically, you can open it in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. For more information, see Upgrading Tests from Earlier Versions of Visual Studio. |
||
Model-View-Controller framework |
If the Model-View-Controller (MVC) project uses version 3 or 4, you can open this project in Visual Studio 2012 RC. By default, Visual Studio 2010 with SP1 supports only MVC 2 and 3, and Visual Studio 2012 RC supports only MVC 3 and 4. For information about how to automatically upgrade from MVC 2 to MCV 3, see ASP.NET MVC 3 Application Upgrader. For information about how to manually upgrade from MVC 2 to MVC3, see Upgrading an ASP.NET MVC 2 Project to ASP.NET MVC 3 Tools Update. If your project targets the .NET Framework 3.5 with SP1, you must retarget your project to use the .NET Framework 4. |
||
MSI setup (.vdproj) |
You can’t open this project in Visual Studio 2012 RC because it doesn't support that project type. We recommend that you use InstallShield Limited Edition for Visual Studio (ISLE), a free deployment solution that directly supports most Windows platforms and application runtimes. ISLE also supports importing data and settings from Visual Studio Installer projects. For more information, see Windows Installer Deployment. |
||
Office 2010 VSTO |
If the project targets the .NET Framework 4, you can open this project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. |
||
SharePoint 2010 |
You can open the project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. |
||
SQL Server 2008 R2 Express |
If SQL Server 2008 R2 Express is installed on the computers that are running Visual Studio 2012 RC and Visual Studio 2010 with SP1, you can open the project in both of those versions of Visual Studio. |
||
SQL Server Report Project |
You can open the project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. For local mode only (that is, when not connected to SQL Server), you won’t get the design-time experience for controls that are associated with the viewer in Visual Studio 2010, but the project will function correctly at runtime.
|
||
Unit tests |
You can use Microsoft Test Manager 2010 with SP1 in Visual Studio and Visual Studio 2012 RC to open tests that were created in either of these versions. For more information, see Upgrading Tests from Earlier Versions of Visual Studio. |
||
Visual C++ |
If Visual Studio 2012 RC and Visual Studio 2010 with SP1 are installed on the same computer, you can open the project in both of those versions of Visual Studio. For more information, see How to: Upgrade Visual C++ Projects to Visual Studio 2012. |
||
Visual Studio 2010 web |
If you allow Visual Studio to upgrade the project automatically, you can open it in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. |
||
Visual Studio 2010 Database (.dbproj) |
If you convert the project to a SQL Server Data Tools Database project, you can open it in Visual Studio 2012 RC. However, Visual Studio 2012 RC doesn’t support the following artifacts:
If you install SQL Server Data Tools, you can open the project in Visual Studio 2010 with SP1 after the migration. For more information, see Microsoft SQL Server Data Tools. |
||
VS 2010 SQL Server Data Tools |
You can open this project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. |
||
Visual Studio Lab Management |
You can use Microsoft Test Manager in Visual Studio 2010 with SP1 or Visual Studio 2012 RC to open environments that were created in either of these versions. However, your version of Microsoft Test Manager must match your version of Team Foundation Server before you can create environments. For more information, see Upgrading Lab Management Components from Visual Studio 2010. |
||
Visual Studio SDK/VSIX |
If you upgrade the project, you can open it in Visual Studio 2012 RC only. For more information, see How to: Upgrade Visual Studio SDK/VSIX Projects to Visual Studio 2012. |
||
Windows Communication Foundation, Windows Presentation Foundation |
You can open this project in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. |
||
Windows Mobile |
You can’t open this project in Visual Studio 2012 RC because it doesn't support the project type. |
||
Windows Phone |
You can’t open this project in Visual Studio 2012 RC because it doesn't support the project type. |
||
Other |
You can open most other types of projects in both Visual Studio 2012 RC and Visual Studio 2010 with SP1. |
For a more detailed explanation of why this is the case and how the decision making process was done by the VS team make sure to read Richa Prasad’s most excellent blog post here:
http://blogs.msdn.com/b/visualstudio/archive/2012/03/28/round-tripping-with-visual-studio-11.aspx
Richa does a great job of explaining the overall decisions around this feature as well as showing what happens (and what you can expect to see) in those scenarios where it isn’t as clean.
For example, here is what you would see when trying to import a setup project that is no longer supported:
And here is the resulting migration report generated by Visual Studio 2012:
And there you have it! Give project round-tripping a shot yourself and see if you think it’s great, too!