You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: "Deployment in Visual C++ | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/04/2016"
4
+
ms.date: "9/21/2017"
5
5
ms.reviewer: ""
6
6
ms.suite: ""
7
7
ms.technology:
@@ -18,47 +18,41 @@ caps.latest.revision: 21
18
18
author: "corob-msft"
19
19
ms.author: "corob"
20
20
manager: "ghogen"
21
-
translation.priority.ht:
22
-
- "cs-cz"
23
-
- "de-de"
24
-
- "es-es"
25
-
- "fr-fr"
26
-
- "it-it"
27
-
- "ja-jp"
28
-
- "ko-kr"
29
-
- "pl-pl"
30
-
- "pt-br"
31
-
- "ru-ru"
32
-
- "tr-tr"
33
-
- "zh-cn"
34
-
- "zh-tw"
35
21
---
36
22
# Deployment in Visual C++
37
-
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.
38
-
39
-
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.
40
-
41
-
## Central Deployment
42
-
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:
43
-
44
-
-*Redistributable package files*, which are stand-alone command-line executables that you can use to install the Visual C++ redistributable libraries.
45
-
46
-
-*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.
47
-
48
-
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.
49
-
50
-
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.
51
-
52
-
## Local Deployment
53
-
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.
54
-
55
-
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.
56
-
57
-
## Static Linking
58
-
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.
59
-
60
-
## Troubleshooting
61
-
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)](http://msdn.microsoft.com/library/windows/desktop/ms682586.aspx).
Installation of your application on a computer other than your development computer is known as *deployment*. When you deploy a Visual C++ application to another computer, you must install both the application and any library files it depends on. Visual Studio enables three ways to deploy the Visual C++ libraries together with your application: *central deployment*, *local deployment*, and *static linking*. Central deployment puts the library files under the Windows directory, where the Windows Update service can update them automatically. Local deployment puts the library files in the same directory as your application. You must redeploy any locally deployed libraries yourself to update them. Static linking binds the library code into your application. You must recompile and redeploy your application to take advantage of any updates to the libraries when you use static linking.
25
+
26
+
## Central Deployment
27
+
28
+
In central deployment, library DLL files are installed in the Windows\System32 directory, or for 32-bit library files on x64 systems, the Windows\SysWow64 directory. Microsoft automatically updates its libraries that are centrally deployed. For Visual C++ libraries that are locally deployed or statically linked, you must provide the updates.
29
+
30
+
To centrally deploy Visual C++ libraries, you can use one of these two sources for the files to install:
31
+
32
+
-*Redistributable package* files, which are stand-alone command-line executables that contain all the Visual C++ redistributable libraries in compressed form, or
33
+
34
+
-*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.
35
+
36
+
A redistributable package file installs all of the Visual C++ libraries for a particular system architecture. For example, if your application is built for x64, you can use the vcredist_x64.exe redistributable package to install all the Visual C++ libraries your application uses. You can program your application installer to run the redistributable package as a prerequisite before you install your application.
37
+
38
+
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 or as few merge modules as your application requires. Use merge modules when you need to minimize the size of your deployment binaries.
39
+
40
+
Because central deployment by using a redistributable package or merge modules enables Windows Update to automatically update the Visual C++ libraries, we recommend that you use the library DLLs in your application instead of static libraries, and use central deployment instead of local deployment.
41
+
42
+
## Local Deployment
43
+
44
+
In local deployment, library files are installed in your application folder together with the executable file. Different versions of Visual C++ redistributable libraries can be installed in the same folder because the file name of each version includes its version number. For example, version 12 of the C++ runtime library is msvcp120.dll, and version 14 is msvcp140.dll.
45
+
46
+
Because Microsoft cannot automatically update locally deployed Visual C++ libraries, we do not recommend 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.
47
+
48
+
## Static Linking
49
+
50
+
In addition to dynamically linked libraries, Visual Studio supplies most of its libraries as static libraries. You can statically link a static library to your application, that is, link the library object code directly into the application. This creates a single binary without a DLL dependency, so that you don't have to deploy the Visual C++ library files separately. However, we do not recommend 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.
51
+
52
+
## Troubleshooting deployment issues
53
+
54
+
The load 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)](http://msdn.microsoft.com/library/windows/desktop/ms682586.aspx).
0 commit comments