Redistributing Visual C++ Files
When you develop an application by 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 must redistribute all the files that are required to support the application on the target system. For more information about which files you might want to redistribute with your application, see Deployment Examples and Determining Which DLLs to Redistribute.
Only some Visual C++ files can be redistributed with your application. See the Microsoft Software License Terms for Visual Studio 2005 and the Redist.txt file to see which files can be redistributed with your application. EULA.txt is in the \Setup directory on the first Visual C++ 2008 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 by 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.
An application local folder is a folder that contains an application executable file. Private side-by-side assemblies must be deployed within the application local folder or one of its subfolders. For more information about the naming rules that apply to subfolders that contain private side-by-side assemblies, see Assembly Searching Sequence.
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 Redistributing Using Merge Modules. An example of this deployment may be found in How to: Deploy a Setup and Deployment Project.
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.
We recommend that you use this package to redistribute Visual C++ libraries for applications that you built with Visual C++ Express and for cases when you want to deploy all Visual C++ libraries at the same time.
For an example of how to use this package see How to: Deploy using XCopy.
When you deploy 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. They must be deployed to the target computer in a subdirectory in the application local folder, according to 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 Visual C++ Libraries as Shared Side-by-Side Assemblies. A description of the rules that you must follow when you deploy private assemblies for loading at runtime can be found in Assembly Searching Sequence. For an example of how to deploy Visual C++ libraries as a private assembly, see How to: Deploy using XCopy.
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, see Choosing a Deployment Method.
If a Visual C++ library DLL (for example, MSVCR90.DLL) is reachable (ether installed in the application-local folder or in the System folder), you may get the following error message:
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 the following error message:
This application has failed to start because MSVCR90.dll was not found. Re-installing the application may fix this problem.
To resolve these errors, you must 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 Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies.