Redistributing Visual C++ Files


Are you here because you are looking for a download of one of the Visual C++ Runtime files? Go to the Microsoft website and enter Visual C++ Redistributable in the search box. Download and install the redistributable package for the architecture of your computer (for example, x64 if you are running 64-bit Windows) and the version of Visual C++ (for example, 2015) that you need.

When you deploy an application, you must also deploy the files that are required to support it. If any of these files are provided by Microsoft, check whether you are permitted to redistribute them. To review the Visual Studio license terms, see the License terms link in the About Microsoft Visual Studio dialog box in the IDE, or download the Microsoft Software License Terms file. To view the "REDIST list" that is referenced in the "Distributable Code" section of the Microsoft Software License Terms for certain editions of Visual Studio, see Distributable Code for Microsoft Visual Studio 2017 and Microsoft Visual Studio 2017 SDK (Includes Utilities and BuildServer Files), or for Visual Studio 2015, see Distributable Code for Microsoft Visual Studio 2015 and Microsoft Visual Studio 2015 SDK. For more information about redistributable files, see Determining Which DLLs to Redistribute and Deployment Examples.

To deploy redistributable Visual C++ files, you can use the Visual C++ Redistributable Packages (VCRedist_x86.exe, VCRedist_x64.exe, or VCRedist_arm.exe) that are included in Visual Studio. In Visual Studio 2017, these files can be found in the Program Files[ (x86)]\Microsoft Visual Studio\2017\edition\VC\Redist\MSVC\lib-version folder, where edition is the Visual Studio edition installed, and lib-version is the version of the libraries to redistribute. In Visual Studio 2015, these files can be found under your Visual Studio installation directory in Program Files [(x86)]\Microsoft Visual Studio version\VC\redist\locale\. Another option is to use redistributable merge modules (.msm files), which in Visual Studio 2017 can be found in the Program Files [(x86)]\Microsoft Visual Studio\2017\edition\VC\Redist\MSVC\lib-version\MergeModules\ folder. In Visual Studio 2015 these can be found in Program Files [(x86)]\Common Files\Merge Modules\. It's also possible to directly install redistributable Visual C++ DLLs in the application local folder, which is the folder that contains your executable application file. For servicing reasons, we do not recommend that you use this installation location.

The Visual C++ Redistributable Packages install and register all Visual C++ libraries. If you use one, you must set it to run on the target system as a prerequisite to the installation of your application. We recommend that you use these packages for your deployments because they enable automatic updating of the Visual C++ libraries. For an example about how to use these packages, see Walkthrough: Deploying a Visual C++ Application By Using the Visual C++ Redistributable Package.

Each Visual C++ Redistributable Package checks for the existence of a more recent version on the machine. If a more recent version is found, the package is not installed. Starting in Visual Studio 2015, redistributable packages display an error message stating that setup failed. If a package is run by using the /quiet flag, no error message is displayed. In either case, an error is logged by the Microsoft installer, and an error result is returned to the caller. Starting in Visual Studio 2015 packages, you can avoid this error by checking the registry to find out if a more recent version is installed. The currently installed version is stored in the HKEY_LOCAL_MACHINE\SOFTWARE[\Wow6432Node]\Microsoft\VisualStudio\vs-version\VC\Runtimes\{x86|x64|ARM} key, where vs-version is the version number for Visual Studio (14.0 for both Visual Studio 2015 and Visual Studio 2017, because the updated 2017 redistributable is binary compatible with the 2015 version), and where the key is ARM, x86, or x64 depending on the installed vcredist versions for the platform. (You don't need to check under the Wow6432Node subkey unless you are using RegEdit to view the version of the installed x86 package on an x64 platform.) The version number is stored in the REG_SZ string value Version and also in the set of Major, Minor, Bld, and Rbld REG_DWORD values. To avoid an error at install time, you must skip installation of the redistributable package if the currently installed version is more recent.

If you use a merge module that contains a Visual C++ DLL, you must include it in the Windows Installer package (or similar installation package) that you are using to deploy the application. For more information, see Redistributing By Using Merge Modules. For an example, see Walkthrough: Deploying a Visual C++ Application By Using a Setup Project, which also shows how to use InstallShield Limited Edition to create an installation package.

Potential Run-Time Errors

If Windows cannot find one of the redistributable library DLLs required for your application, a message similar to this may be displayed: "This application has failed to start because library.dll was not found. Re-installing the application may fix this problem."

To resolve this kind of error, make sure that your application installer builds correctly and that the redistributable libraries are correctly deployed on the target system. For more information, see Understanding the Dependencies of a Visual C++ Application.

Title Description
Redistributing By Using Merge Modules Describes how to use Visual C++ redistributable merge modules to install the Visual C++ runtime libraries as shared DLLs in the %windir%\system32\ folder.
Redistributing Visual C++ ActiveX Controls Describes how to redistribute an application that uses ActiveX Controls.
Redistributing the MFC Library Describes how to redistribute an application that uses MFC.
Redistributing an ATL application Describes how to redistribute an application that uses ATL. Starting in Visual Studio 2012, no redistributable library for ATL is required.
Deployment Examples Links to examples that demonstrate how to deploy Visual C++ applications.
Deploying Desktop Applications Introduces Visual C++ deployment concepts and technologies.