Export (0) Print
Expand All

Choosing a Deployment Method

In most cases deployment of Visual C++ applications is done with Windows Installer deployment. For more information on deployment methods supported within Visual Studio and alternatives, see Choosing a Deployment Strategy. ClickOnce deployment for Visual C++ native applications is not supported in Visual Studio 2010; however, it is possible to deploy Visual C++ applications via ClickOnce on the command line. For more information, see ClickOnce Deployment for Visual C++ Applications.

Visual Studio 2010 installs Visual C++ libraries as shared DLLs in the %windir%\system32 directory. In order to ensure that your Visual C++ application will run on a computer without Visual C++ installed, you may have to redistribute Visual C++ DLLs with your application and ensure they are installed on the target computer.

There are three ways to redistribute Visual C++ DLLs:

  • We recommend that you use the Visual C++ Redistributable Package (VCRedist_x86.exe, VCRedist_x64.exe, VCRedist_ia64.exe) to install all Visual C++ libraries as shared DLLs in %windir%\system32. Visual Studio installs this package in the %WindowsSdkDir%\Bootstrapper\Packages folder. You can also download it from the Microsoft Download Center. For an example of how to use this package, see Walkthrough: Deploying a Visual C++ Application By Using the Visual C++ Redistributable Package.

  • Use Visual C++ Redistributable Merge Modules to install a particular Visual C++ library as shared DLLs in %windir%\system32. Access to this folder requires that the installer application be run by a user with administrative rights. For more information please see Redistributing By Using Merge Modules. An example of this deployment may be found in Walkthrough: Deploying a Visual C++ Application By Using a Setup Project.

  • Install a particular Visual C++ DLL in the same folder as the application by using files provide in the Program Files\Microsoft Visual Studio 10.0\VC\Redist directory. This way is recommended to enable installation of applications by users who do not have administrative rights or when it should be possible to run an application from a share.

When installing Visual C++ libraries using redistributable merge modules, the DLLs are deployed as shared DLLs in %windir%\system32. Access to this folder requires that the installer application be run by a user with administrative rights.

If an installation is run by a user who does not have administrative rights, the installation fails to deploy the Visual C++ DLLs and the application will not run. Also, some products may allow installation on a per-user basis, but merge modules install libraries into shared locations and impact all users of the system. In both these and similar scenarios, the supported technique is to install the required DLLs in the directory of a particular user's application.

With this technique, it is enough to copy DLLs to the application's local folder. The operating system's loader, when executing the application, uses the search order described in LoadLibraryEx.

Incorrect redistribution of Visual C++ libraries may result in run-time errors during execution of an application that depends on them

It is not recommended to redistribute C/C++ applications that statically link to Visual C++ libraries. It is often mistakenly assumed that by statically linking your program to Visual C++ libraries it is possible to significantly improve the performance of an application. However the impact on performance of dynamically loading Visual C++ libraries is insignificant in almost all cases. Furthermore, static linking does not allow for servicing the application and its dependent libraries by either the application's author or Microsoft. For example, consider an application that is statically linked to a particular library, running on a client computer with a new version of this library. The application still uses code from the previous version of this library, and does not benefit from library improvements, such as security enhancements. Authors of C/C++ applications are strongly advised to think through the servicing scenario before deciding to statically link to dependent libraries, and use dynamic linking whenever possible.

Community Additions

ADD
Show:
© 2014 Microsoft