
Redistributing Visual C++ libraries
There are three ways to redistribute Visual C++ DLLs:
Using Visual C++ Redistributable Merge Modules to install a particular Visual C++ library as shared side-by-side assemblies into the native assembly cache (WinSxS folder). This is the primary recommended way for redistributing Visual C++ libraries. Access to this folder requires that the installer application be run by a user with administrative rights. For more information please see Redistributing Using Merge Modules. An example of this deployment may be found in How to: Deploy a Setup and Deployment Project.
Using Visual C++ Redistributable Package (VCRedist_x86.exe, VCRedist_x64.exe, VCRedist_ia64.exe) to install all Visual C++ libraries as shared side-by-side assemblies into the native assembly cache (WinSxS folder). This package is installed by Visual Studio into %WindowsSdkDir%\Bootstrapper\Packages\ folder and can also be downloaded from the Microsoft download site Microsoft Visual C++ 2005 Redistributable Package (x86). Redistributing Visual C++ libraries using this package is recommended for applications built with Visual C++ Express and for cases when deployment of all Visual C++ libraries at once is desirable. For an example of how to use this package please see How to: Deploy using XCopy.
Install a particular Visual C++ assembly as a private assembly for the application using files provide in the Program Files\Microsoft Visual Studio 8\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. For an example, please see How to: Deploy using XCopy.
Note: |
|---|
On Windows Server 2000, the only recommended and supported way to redistribute
Visual C++ libraries is by using Redistributable Merge Modules.
|
When installing Visual C++ libraries using redistributable merge modules, the assemblies are deployed as shared side-by-side assemblies into the native assembly cache (WinSxS folder). 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++ assemblies 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 assemblies as private side-by-side assemblies for a particular user's application.
With this technique, it is enough to copy a folder with DLLs and manifests for dependent assemblies to the application's local folder. The operating system's loader, when executing the application, still looks for dependent assemblies in the WinSxS folder first; however when a corresponding assembly cannot be found, the loader loads a private assembly from this sub-directory.
Incorrect redistribution of Visual C++ libraries may result in run-time errors during execution of an application that depends on them. A list of potential errors and resolutions to these errors can be found in Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies.