When you use Visual C++ to build windows applications, a key step to guarantee that your application runs on another computer is to ensure that you deploy all dependencies of your application to that computer. At the minimum, your applications depends on Visual C++ libraries such as MFC, CRT, Standard C++ Library and other. The steps you need to take to resolve dependency on Visual C++ libraries depend on the version of Visual C++ you use. Below you may find links to official documentation for various versions of Visual Studio and blog posts with the guidance on resolving your application dependency on Visual C++ library.
New deployment model for ATL, MFC, and CRT libraries based on concepts of isolated
applications and side-by-side
assemblies was introduced in Visual C++ 2005. Martyn Lovell in one of his posts provided a detailed explanation for why VC++ team had to change
deployment model for VC++ DLLs, http://blogs.msdn.com/martynl/archive/2005/10/13/480880.aspx.
I have summarized steps required to run Visual C++ application on another computer when it is built using Visual C++ Express 2005 or Visual Studio 2005 in this post. There are several potential errors that Windows reports for applications incorrectly resolve dependencies on Visual C++ libraries such as:
- 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.
- R6034 An application has made an attempt to load the C runtime library
- This application has failed to start because MSVCR80.dll was not found.
Re-installing the application may fix this problem.
I have published several posts to provide guidance for resolving those:
- How to resolve "the system cannot execute the specified program" error.
- How to embedded manifest inside a binary using makefiles
- How to resolve deployment errors from Windows SxS technology experts.
documentation is available on MSDN and below are the direct links:
Keep in mind that installing Visual C++ Redistributable Package for VS2005 usually resolves all the issues in this area. It is also possible to silently install VCRedist as I describe in Silent
installs of VCRedist.EXE shipped with VS2005.
The Service Pack release to Visual
Studio 2005 introduce the new version of VC++ libraries and some new
issues. I have published several posts that help to resolve the most
to questions on adapting VS2005 SP1 in Visual C++ applications
solution to two references to different versions of CRT, MFC, ATL in
one application manifest file
SP1 does update VC++ redistributable MSMs in \common files\merge
All troubleshooting suggestions apply and help to
resolve most of the issues. Keep in mind that
C++ Redistributable Package for VS2005 SP1 usually resolves all the
issues in this area.
Visual Studio 2008 and Visual Studio 2008 SP1
Visual Studio 2008 continued to use
the same deployment model as Visual Studio 2005. The version number of
the libraries has changed but all the topics I posted about for Visual Studio 2005. Note that at this point my focus shifted to enabling C++ developers to build clients to web services and web services in native code. See my posts under Web Services. However the official documentation has been updated and you should be able to find answers in these topics:
issues in this area.
Visual Studio 2010
For this release, Visual C++ team has stopped using side-by-side deployment model for Visual C++ libraries. All libraries became again a simple DLL and resolving dependencies on them follows the old rules that apply to resolving dependencies on them. The difference between VS2010 and VS2008 are summarized in this article. They have updated the official documentation with the new guidance, which you may find here:
Dependencies of a Visual C++ Application
how to deploy Visual C++ libraries that application depends on
- Deployment of Visual C++ libraries in Visual Studio 2010
Visual C++ Libraries
For this release, Visual C++ team has started to openly recommend developers use the Visual C++ Redistributable Package
to install all Visual C++ libraries as shared DLLs in %windir%\system32.
Visual Studio installs this package in the
%WindowsSdkDir%\Bootstrapper\Packages folder. There is now an example of how to use VCRedist under Walkthrough:
Deploying a Visual C++ Application By Using the Visual C++
Redistributable Package. Downloading and installing Visual
C++ Redistributable Package for VS2010 allows you to correctly deploy Visual C++ Libraries on another computer.
I hope this post helps you to understand and resolve your application dependency on Visual C++ Library. At the same time, I have to let you know that this area has not been the area of my focus for quite a while. There are many great articles on MSDN that cover this area well by now. Lately my focus is on overall guidance to developers on developing windows applications and best practices for program
management and project
management to help them achieve success in