|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Redistributing Visual C++ Files
When you develop an application using Visual C++, you have the advantage of working on a computer that is not only a good development environment, but is also a convenient environment on which to run and test applications. However, when you want to deploy your application to other computers, you need to redistribute all the files needed to support the application on the target system. For more information on which files you may need to redistribute with your application, seeand .
Only some Visual C++ files are allowed to be redistributed with your application. Please consult the EULA for Visual Studio 2005 and the Redist.txt file to see which files may be redistributed with your application. EULA.txt can be found in the \Setup directory on the first Visual Studio 2005 product CD or on the DVD, and Redist.txt is located in the Program Files\Microsoft Visual Studio 2005 directory on the second CD or on the DVD.
Visual C++ files can be redistributed using either the provided Redistributable Merge Modules, or the Visual C++ Redistributable Package, or by deploying specific Visual C++ assemblies as private side-by-side assemblies in the application local folder.
In the first case, a merge module with a specific Visual C++ assembly has to be included in a Windows Installer package or similar installation package used to deploy this application to another computer. For more information, see. An example of this deployment may be found in .
The Visual C++ Redistributable Package (VCRedist_x86.exe, VCRedist_x64.exe, VCRedist_ia64.exe) has to be executed on the target system as a prerequisite to installation of the application. This package installs and registers all Visual C++ libraries.
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.
When deploying Visual C++ libraries as a private side-by-side assembly, all DLLs and the manifest file that form this assembly have to be added to the Windows Installer or similar installation package and deployed to the target computer in a subdirectory in the application local folder, following the rules for deploying private assemblies. Information on which Visual C++ DLLs and manifest files are part of which Visual C++ assemblies can be found in. A description of the rules that must be followed when deploying for loading at runtime can be found in . For an example of how to deploy Visual C++ libraries as a private assembly, please see .
Potential run-time errors
If a manifest is present in your application but a required Visual C++ library is not installed in the WinSxS folder, you may get one of the following error messages depending on the version of Windows on which you try to run your application:
The application failed to initialize properly (0xc0000135).
This application has failed to start because the application configuration is incorrect. Reinstalling application may fix this problem.
The system cannot execute the specified program.
If no manifest is present in your application, the error you get depends on whether the Visual C++ library your application depends on is deployed in the application local folder or in a shared folder such as the System folder or WinSxS folder.
It is not supported to redistribute C/C++ applications that are built without a manifest. Visual C++ libraries cannot be used by C/C++ applications without a manifest binding the application to these libraries. For more information, please see.
If a Visual C++ library DLL (for example, MSVCR80.DLL) is reachable (ether installed in the application-local folder or in the System folder), you may get
R6034 An application has made an attempt to load the C runtime library incorrectly.
If the DLL is not reachable and Windows cannot load this DLL for your application, you may get
This application has failed to start because MSVCR80.dll was not found. Re-installing the application may fix this problem.
To resolve these errors, you need to make sure that your application is built correctly and Visual C++ libraries are correctly deployed on the target system. To identify the root cause of these run-time errors, follow the steps outlined in.