When you deploy a Visual C++ application to another computer, you must install both the application and any library files it depends on. If a library is updated—for example, when a security vulnerability is corrected—you'll probably want to apply the update wherever your application is deployed.
Visual Studio enables three ways to deploy the Visual C++ libraries together with your application: central deployment, local deployment, and static linking. Microsoft automatically updates its libraries that are centrally deployed. For Visual C++ libraries that are locally deployed or statically linked, the application writer must provide the updates.
In central deployment, Visual C++ library files are installed in the %windir%\system32\ directory. To centrally deploy Visual C++ libraries, you can use one of these:
Redistributable package files, which are stand-alone command-line executables that you can use to install the Visual C++ redistributable libraries.
Redistributable merge modules (.msm files), which you can use to deploy specific libraries and which you include in your application’s Windows Installer (.msi) file.
A redistributable package file installs the Visual C++ libraries for a particular system architecture. You can program your application setup to run it as a prerequisite before you install your application. A merge module enables the inclusion of setup logic for a specific Visual C++ library in a Windows Installer application setup file. You can include as many merge modules as the application requires.
Because central deployment of Visual C++ libraries by using a redistributable package enables automatic updating by Microsoft, we recommend that you use dynamic linking and redistributable packages for your application.
In local deployment, library files are installed in the application folder together with the executable file. Different versions of libraries can be installed in the same folder because the file name of each version is made unique by the inclusion of its version number. For example, version 12 of the C runtime is msvcr120.dll.
Because Microsoft cannot automatically update locally deployed Visual C++ libraries, we caution against local deployment of these libraries. If you decide to use local deployment of redistributable libraries, we recommend that you implement your own method of automatically updating the locally deployed libraries.
You can statically link a Visual C++ library to an application—that is, compile it into the application—so that you don't have to deploy the Visual C++ library files separately. However, we caution against this approach because statically linked libraries cannot be updated in place. If you use static linking and you want to update a linked library, you have to recompile and redeploy your application.
The loading order of Visual C++ libraries is system-dependent. To diagnose loader issues, use depends.exe or where.exe. For more information, see Dynamic-Link Library Search Order (Windows).