Using Visual C++ Runtime in Centennial project

Getting started

During Build 2015, we announced the Desktop Bridge (formerly called Project Centennial) to bring your desktop apps to UWP. With the Desktop App Converter, you can package your desktop application as an appx package that can be deployed to a Windows 10 Desktop. See this link to learn more about the Desktop Bridge. If you want to convert your C++ desktop application (win32, MFC, etc.) you have to handle deployment of VC++ runtimes, such as vcruntime140.dll, as you always do for C/C++ applications.

We have created support for Visual C++ Runtime in this context for the version 11.0, 12.0 and 14.0 of the VC++ Runtime. Centralized deployment of the VC++ runtime DLLs through the Windows Store. This Runtime is the Desktop Visual C++ libs for CRT, STL, ConCRT, MFC, ATL and C++ amp. These serviced versions of the VC++ runtime are available on the Windows Download center:

For development of your applications, we have created framework packages with the desktop libraries for the VC++ 14.0 (VS2015), VC++ 12.0 (VS2013) and VC++ 11.0 (VS2011) versions of the C Runtime. This installer will place the framework packages under the Extension SDKs folder: %PROGRAMFILES(X86)%\Microsoft SDKs\Windows Kits\10\ExtensionSDKs

We have created framework packages that will contain all the Visual C++ Runtime components for the following targets: X86, x64 for debug and release.

Referencing the VC Runtime framework packages from converted desktop apps:

1. First, ensure you are set up to use Desktop Bridge (Centennial). For instructions, see Desktop App Converter Preview (Project Centennial).

2. Run the converter and then installer for your Win32 application. The converter captures the layout, and any changes made to the registry and outputs an Appx with manifest.

3. In the Appx layout, update the AppxManifest.xml to contain a reference to the VCLibs UWPDesktop framework package by adding the <PackageDependency> element under the <Dependencies> element:

<PackageDependency Name=”Microsoft.VCLibs.140.00.UWPDesktop” MinVersion=”14.0.24217.0″ Publisher=”CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US” />

Also, please remove any C++ Runtime dlls from the appx layout. Consuming the runtime via framework packages is the recommended approach.

Note: Starting with Desktop App Converter v0.1.23, converter will auto detect VCLibs dependency and add the PackageDependency entry in the AppxManifest.xml. It will also remove any local copies of the C++ runtime dlls.

4. Install the VCLibs UWPDesktop framework package corresponding to the configuration and architecture you are targeting, using add-appxpackage cmdlet.

For instance, if your application is targeting x86 Retail config, open powershell:

a. Goto %PROGRAMFILES(X86)%\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs.Desktop\14.0\Appx\Retail\x86

b. Add-appxpackage Microsoft.VCLibs.x86.14.00.Desktop.appx

5. Deploy your application using the add-appxpackage –register AppxManifest.xml cmdlet or by repackaging it using MakeAppx, see App packager (MakeAppx.exe).

Note: You could install these framework using DependencyPath parameter from the Add-AppxPackage command. See here for more detail on this option

For Debugging:

To deploy a debug version of the application, add a PackageDependency to the Debug framework package, Microsoft.VCLibs.140.00.Debug.UWPDesktop:

<PackageDependency Name=”Microsoft.VCLibs.140.00.Debug.UWPDesktop” MinVersion=”14.0.24217.0″ Publisher=”CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US” />

Universal CRT (uCRT) is installed in system32 as part of the Windows 10 OS (just like user32.dll), but if you want the debug version of uCRT, you need to install it. You can find the debug version in the Windows 10 SDK (use the same version used to create the app)

In case the target computer doesn’t have the uCRT debug version, you have to package the Debug uCRT app locally. To do this, copy the ucrtbased.dll[1] from C:\Program Files (x86)\Windows Kits\10\bin\<arch>\ucrtbased.dll next to the executable.

VC++ 12.0 support:

The framework packages for VC12.0(Visual studio 2013) are installed under: %PROGRAMFILES(X86)%\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs.Desktop.120\

To reference the 120 framework package, add the following line to the AppxManifest.xml:

<PackageDependency Name=”Microsoft.VCLibs.120.00.UWPDesktop” MinVersion=”12.0.40653.0″ Publisher=”CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US” />

For Debugging:

Change the PackageDependency Name to Microsoft.VCLibs.120.00.Debug.UWPDesktop to deploy the debug version.

Note that the existing VC++ 12.0 libraries created during the Windows 8 timeframe have runtime checks to determine whether the app is running under the app container or not. When running desktop apps as a packaged app, these checks might limit the functionality of the desktop app or cause it to behave like a UWA (Universal Windows Application) (limited file system access or create thread initializing MTA etc.). We have fixed this behavior in the VC++ libraries contained in these framework packages and thus removing the modern app limitations from your desktop applications.

Next steps

Try Desktop Bridge, package your desktop app as an appx, side-load, deploy and let us know your experience and issue using the Visual C++ runtime DLLs in this context.


[1] Under Windows 10 SDK License