Are you currently developing your C++ projects in an older version of Visual Studio? If your reasons for avoiding the all-new features in VS 2015 are covered next, then read on: this post may have good news for you.
Help! I am stuck!
There are many reasons why you may want to use Visual Studio 2015 in your day-to-day job. Just to name a few:
- New C++ refactoring capabilities and editor experimental features
- New Diagnostics tools debugger window and Error List window
- Revamped breakpoints, exceptions window and new PerfTips
- New VS 2015-only extensions like the C++ Quick fixes or the 2015 Productivity Power Tools.
You can download VS 2015 and upgrade your projects today. We know however that there are projects for which a full upgrade is not a trivial decision.
- Are your binaries tied to an older version of CRT that for maintenance reasons you can’t upgrade?
- Are you dependent on older (non-conformant) language constructs that would break if you move to a more recent compiler?
- Are you relying on 3rd party libraries compiled with a specific version of the VC toolset?
- Are you exposing C++ APIs for other parties to consume, so you’re restricted to a specific version of the C++ compiler & CRT?
If these cover your reasons for not using VS 2015, I’m going to let you in on a little secret: you can start using Visual Studio 2015 today without having to change your toolset version (i.e. the current compiler and the matching target CRT).
Well, it’s not really a secret that Visual Studio supports native multi-targeting and round-tripping. And we definitely want to shine more light on it:
Native multi-targeting is the ability of the latest IDE to build using toolsets installed by previous versions of Visual Studio (VS 2008 and up).
Round-tripping is the ability of the latest IDE to load projects created by a previous IDE version without making any changes to the project assets (VS 2010 projects and up), thus allowing it to load back in the previous IDE too.
Using these features means that you will be taking advantage of the latest IDE features in VS 2015 but won’t have access to the latest advances in the C++ compiler, libraries and build tools (e.g. build throughput). Disclaimer: there are IDE features that also depend on the latest toolset capabilities and they will be incompatible with older toolsets: e.g. type information will be missing in the Memory Profiler, and the refactoring operation “Convert to Raw string literals” will generate C++11-compliant code, making it not compile with VS 2012 compilers and older.
Say again? How does Native retargeting work?
Taking advantage of native multi-targeting is as simple as installing Visual Studio 2015 side-by-side with your older version, then opening your existing project in VS 2015.
During project load, you will receive a prompt on whether you want to upgrade to the latest C++ toolset shipping with VS 2015. Since you want to stay with the older compiler and libraries version, you should decline by hitting the “Cancel” button – you can always upgrade later too if you choose to experiment with the latest C++ toolset.
Now every time you build in VS 2015, the binaries that get generated are fully compatible with the ones you were previously building in your older version, e.g. VS2010. That’s because behind the scenes, VS 2015 delegates the build to the same C++ compiler and consumes the same libraries that your older IDE ships with. That is also the reason the dialog warns you to keep the older VS version installed if you hit Cancel.
A new dilemma: should I let my team know? About project round-tripping
Because you chose not to upgrade your project, VS 2015 doesn’t make anychanges to your project or solution. So the fact that you’re using VS 2015 in your day-to-day work might as well be your little secret – the rest of your team will continue to use the older version without any clue that you’ve upgraded. It’s kind of a big secret, since your colleagues won’t know how you suddenly increased your productivity so much!
So, can you really keep this a secret? Once the cat is out of the bag, everyone could be using VS 2015 around the office — our whole team here in Redmond agrees that’s a good thing (and… we’re not biased at all)
PS: What you’ll notice is that everyone in the team will see the same upgrade prompt the first time they load the project in VS 2015. So if you want to avoid an accidental pull request that upgrades all your projects coming from the enthusiastic junior member in the office down the hall, you can inhibit the upgrade prompt completely before spreading the news by following the instructions in this Connect report “VS 2013 keeps upgrade information in the .suo file” (it works in VS 2015 too).
What about Visual Studio 2008?
Visual Studio 2008 had its own dedicated build system for C++ called VCBuild. With VS 2010, C++ moved to MSBuild so because of this change, to get your VS 2008 projects building in VS 2015 requires a bit more work. The end result will be similar as above: you will be using the VS 2015 IDE and generate binaries that are fully compatible with binaries created from the VS 2008 IDE.
First, in addition to installing VS 2015 you also need to install VS 2010 on the same machine with your VS 2008. This ensures that the appropriate MSBuild scripts that enable targeting VS 2008 are installed (they only ship with VS 2010).
Second, you will need to put your VS 2008 solution and projects through the upgrade process. When you get the below upgrade prompt, please review the information presented.
Now is also a good time to create a backup copy of your VS 2008 .sln file as it will get overwritten by the VS 2015 .sln file (if you’re only experimenting with VS 2015, maybe you may even want to upgrade the backup copy instead of the master copy under source control). When you click “OK”, the wizard will create VC project files with a new extension (.vcxproj) side-by-side with the existing .vcproj files, so as long as you’re taking care of the .sln file, the upgrade will be impact-free for your existing VS 2008 projects.
When the upgrade completes, you will get an upgrade log report. If there are any errors or warnings for any of your projects, you should review the log carefully and make sure that you acknowledge the changes presented and follow up on any action items listed there. For more information on the upgrade log report check out the C++ Project Upgrade Guide.
Now that the project upgrade is complete, your project actually targets the VS 2015 latest toolset. You need to go back to VS 2008 as a last step: open the project properties (right click in Solution Explorer on the project and select Properties) and under General, change Platform Toolset to “Visual Studio 2008 (v90)” instead of “Visual Studio 2015 (v140)”.
After this change, the binaries built by VS 2015 will be built using the same VS 2008 compiler and libraries as the ones building inside the VS 2008 IDE.
Still stuck?
While we’d like to see all of you using the latest C++ toolset too, we know that migrating your code and dependencies takes time and depending on where you are in your project lifecycle, it can add too much risk. However, we hope you find this refresher on native multi-targeting and round-tripping of C++ projects useful, and a good reminder that this shouldn’t hold you back from taking advantage of the IDE improvements in the latest Visual Studio IDE.
To wrap things up, here it is – the link to download Visual Studio 2015. << Click right here!
Is there anything else holding you back? We want to know what other reasons may block you from upgrading today. Let us know by filling out our VS 2015 Upgrade Survey, add your comments below or by contacting us directly at vcupgrade@microsoft.com for a more detailed conversation.