Binary Compatibility and Pain-free Upgrade: Why Moving to Visual Studio 2017 is almost “too easy”

Visual Studio 2017 is a major leap forward in terms of C++ functionality compared with VS 2015. We hope the new release will delight you in your day-to-day job as soon as you can upgrade.

This blog post focuses on the steps needed to upgrade from Visual Studio 2015 to 2017. As promised in our BUILD 2016 talk “6 reasons to move your C++ code to Visual Studio 2015” (click to jump to 1h:04), in this release, our team made it distinctively easy to move your codebase to Visual Studio 2017. And here are the four reasons why.

Get MSVC 2015.3 toolset via the Visual Studio 2017 Installer

Loading your C++ projects targeting an older C++ toolset inside Visual Studio 2017 does not change your project. This allows you to load it back in the previous IDE in case you need to go back, or you still have teammates that are not fully upgraded to 2017. To make it zero-impact to load your existing projects inside Visual Studio 2017, just like in previous releases, the IDE supports project round-tripping.

In previous releases, you had to install both the latest and the old Visual Studio side-by-side for the latest IDE to be able to build your projects. Visual Studio 2017 allows you now to install the MSVC 2015 (v140) toolset directly, making it convenient to bootstrap a new machine as well as reducing the disk footprint of the installation by only installing the needed toolset and not the whole VS 2015 IDE bits.

installerplatform-toolset-selection

VC Runtime in MSVC 2017 is binary compatible with 2015

There are a lot of improvements in the C++ compilers and libraries in this release of Visual Studio that will entice you to move to Visual Studio 2017’s latest toolset (v141) – new standard conformance features, improved codegen, faster build throughput. You may be worried however that your third-party library dependencies are not ready for such a jump. We often hear from customers that this is the number one migration blocker to a new C++ toolset (whether they consume dependencies as binaries or even directly as source).

With the latest MSVC toolset however, you don’t need to worry about this at all. That’s simply because the latest VC Runtime is binary compatible with the VS 2015’s VC Runtime. In other words, if you have a library built with the v140 platform toolset, that binary and your code consuming it will continue to work even if you built your code with the v141 MSVC toolset.

Any binaries built with MSVC v141 toolset will link against the 140 version of the VC Runtime. The VCRedist is only backward compatible, so you will need to redistribute the latest VCRedist 140 available in VS 2017 with your app.

C:\src\ClockApp\Debug>dumpbin ClockApp.exe /IMPORTS | findstr .dll
mfc140ud.dll
KERNEL32.dll
USER32.dll
GDI32.dll
COMCTL32.dll
OLEAUT32.dll
gdiplus.dll
VCRUNTIME140D.dll
ucrtbased.dll

Hundreds of C++ libraries on Vcpkg are now available for Visual Studio 2017

If you haven’t heard about VCPkg yet, no worries – it’s an open-source project from Microsoft to help simplify the acquisition and building of open-source libraries on Windows. If you did use Vcpkg with Visual Studio 2015 for one or more of your open-source dependencies, then you will be happy to learn that these libraries (close to 180 at the time of this writing) are now compiled using MSVC v141 toolset and available for consumption in Visual Studio 2017 projects.

Because v141 is binary compatible with v140, all your existing packages will continue to work without recompilation; however, we do recommend recompiling when you can to enjoy the new compiler optimizations we’ve added to v141!

MSVC compiler version revs to 19.1 (from 19.0 in Visual Studio 2015)

Last but not least, the compiler part of the MSVC v141 toolset is revving only as a minor version in Visual Studio 2017. Note that we continue to make important progress towards C++ conformance as well as improved codegen. As these improvements are made, certain changes to make your code standards-conformant may be required on your side. All these changes are documented in our C++ conformance improvements in Visual Studio 2017 topic on docs.microsoft.com.

compiler-version

Call to action

Visual Studio 2017 comes with many new capabilities that we want you to take advantage of as soon as possible. That’s why we’ve made it probably “too easy” to migrate your projects from Visual Studio 2015. Try it today and let us know what you think!

Before you go, also check out the rest of our announcement posts for VS 2017 launch event, download Visual Studio 2017 and share your feedback with us either in the comments below or on developercommunity.visualstudio.com