Walkthrough: Deploy a Visual C++ application by using the Visual C++ Redistributable Package
To run apps that use Visual C++ runtime libraries, the target machine must have a compatible Microsoft Visual C++ Redistributable Package installed. This step-by-step article describes one way to deploy both the Microsoft Visual C++ Redistributable Package and your Visual C++ application. You can use any installer technology to deploy your app. This walkthrough uses the IExpress Wizard to create a self-extracting executable installer that installs the Redistributable and an application.
You must have these components to complete this walkthrough:
A computer that has Visual Studio installed.
Another computer that doesn't have the Visual C++ libraries.
To use the Microsoft Visual C++ Redistributable Package to deploy an application
If you need a sample application to deploy, create and build an MFC application by following the steps in Walkthrough: Deploying a Visual C++ application by using a setup project. This walkthrough assumes your app is named
MyMFCApplike the sample, but you can change the name to match your app.
Create a file, name it
setup.bat, and add the following commands to it. If your app has a different name, change
MyMFCAppto the name of your app. If your app targets x86, change "Program Files" to "Program Files (x86)". Remove the leading colons (
::) to uncomment the line that installs the Redistributable for your target architecture.
@echo off REM Choose one of the following Redistributable files to install ::vc_redist.x86.exe REM remove leading :: to install Redistributable for x86 ::vc_redist.x64.exe REM remove leading :: to install Redistributable for x64 ::vc_redist.arm64.exe REM remove leading :: to install Redistributable for ARM64 mkdir "C:\Program Files\MyMFCApp" copy MyMFCApp.exe "C:\Program Files\MyMFCApp"
You can apply command-line options to the Redistributable executable in your batch file. For more information, see Command-line options for the Redistributable packages.
Create a self-extracting setup file:
At a command prompt or in the Run window, run
Select Create new Self Extraction Directive file and then choose the Next button.
Select Extract files and run an installation command and then choose Next.
In the text box, enter the name of your app and then choose Next.
On the Confirmation prompt page, select No Prompt and then choose Next.
On the License agreement page, select Do not display a license and then choose Next.
On the Packaged files page, add the following files and then choose Next.
Your app (
The Redistributable for your app's target architecture. We recommend you download the latest supported Redistributable file from Microsoft for your deployment. You can also deploy the Redistributable file found in your Visual Studio installation. In Visual Studio 2015, this file is called
vcredist_arm.exeand is located in
%VCINSTALLDIR%redist\1033\. In Visual Studio 2017 and later, this file is called
vc_redist.arm64.exeand is located in
setup.batfile that you created in the earlier step.
On the Install Program to Launch page, in the Install Program text box, enter the following command line, and then choose Next.
cmd.exe /c "setup.bat"
On the Show window page, select Default and then choose Next.
On the Finished message page, select No message. Choose Next.
On the Package Name and Options page, enter a name for your self-extracting setup file, select the Store files using Long File Name inside Package option, and then choose Next. The end of the file name must be
On the Configure restart page, select No restart. Choose Next.
On the Save Self Extraction Directive page, select Save Self Extraction Directive (SED) file. Choose Next.
On the Create package page, choose Next. Choose Finish.
Test the self-extracting setup file on the other computer that doesn't have the Visual C++ libraries:
On the other computer, download a copy of the setup file. Then, run the setup and follow the steps that it provides. Depending on the options selected, installation might require you to accept a User Account Control elevation request, or to run the installer by using the Run as administrator command.
Run the app.
The self-extracting setup file installs the app that's in the folder you specified in
setup.bat. The app should run successfully because the Microsoft Visual C++ Redistributable Package installer is included in the self-extracting setup file.
To determine which version of the runtime is installed, the installer checks the registry key
<version>value used for Visual Studio 2015, 2017, 2019, and 2022 is 14.0.) If the currently installed version is newer than the version that the installer is attempting to install, the installer returns success without installing the older version and leaves an additional entry on the installed programs page in the Control Panel.
Submit and view feedback for