Click here to Skip to main content
Click here to Skip to main content

How to Distribute C run-time (CRT) Libraries with Your Application

, 16 Jun 2011
Rate this:
Please Sign up or sign in to vote.
Some tips on available ways of distributing CRT DLLs with your Visual C++ application
My application doesn't start because of error message 'The application configuration is incorrect'. What do I do?
 
This error typically means your application can't load the correct C run-time libraries (CRT). This tip describes how to address this problem.
 
First of all, determine what DLL modules your application depends on. You can do this with the help of the Dependency Walker (depends.exe)[^] tool. Open your executable file with the depends.exe to see what CRT modules it depends on. Typically, these modules are msvcrXX.dll and msvcpXX.dll, where XX is the version number of your Visual Studio (for example, Visual Studio 2005 has version number 80).
 
Next, you need to determine the exact version of CRT libraries you use. Microsoft usually upgrades CRT version when releasing service packs and hot fixes for Visual Studio, so this step is very important. To determine the version of your CRT, do the following. In your Visual Studio window, click menu File->Open and open your executable module to view its embedded resources. In appeared window, click RT_MANIFEST folder to see the embedded manifest XML file. The version of CRT is defined by the version attribute. An example CRT manifest is presented below:
 
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>
 
Next you should choose how to distribute the CRT files. There are two ways: either by installing a Visual C++ redistributable package or by installing the DLLs to application local folder (an application local folder is a folder that contains an executable application file). Below these two alternatives are described.

  1. You can download a Visual C++ Redistributable package from the Microsoft Download Center[^]. There are different packages for x86 and x64 architectures, choose the correct one. Also ensure the package has exactly the same version that your CRT manifest has. If version doesn't match, search again for the correct redistributable package. When the correct package is downloaded, you can include it into your application installer and install it with your software.
     
  2. You can copy CRT DLL files and Microsoft.VCXX.CRT.manifest file to your application folder, where XX is the version number. This is called a private installation, because these CRT DLLs won't be shared with other applications. This way may also reduce the size of your installer, because CRT DLLs usually take less space than a redistributable package. You can take the correct CRT DLL files from vcredist subfolder of your Visual Studio folder or from the Visual C++ redistributable package (it is installed to C:\WINDOWS\WinSxS directory).

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

OlegKrivtsov

Russian Federation Russian Federation
I am a software developer currently living in Tomsk, Russia. I received a PhD degree in Computer Science from Tomsk Polytechnic University in 2010. I have been professionally developing C/C++ and PHP software since 2005. I like contributing to open-source and writing programming articles for popular web resources, like CodeProject. Besides writing, I love skiing and watching Formula-1.
Follow on   Twitter

Comments and Discussions

 
GeneralWhat is the best solution when I have two modules in the sam... PinmemberMojoturner28-Jul-11 7:12 
What is the best solution when I have two modules in the same directory that depend on different versions of the CRT. For example Any1.dll depends on CRT 9.0.21022.8 and Any2.dll depends on CRT 9.0.30729.4967. In fact I have this exact situation. If it were just a couple DLLs then I would probably just move those to a different directory but I have hundreds of DLLs and I'm trying to figure out how to accomplish this w/o installing the vcredists. Thanks for your help!
GeneralDoes Microsoft's License Policy allow to redistribute select... Pinmember aphazel 死神15-Jun-11 22:34 
GeneralRe: Yes, Microsoft provides both ways: using vc_redist.exe or us... Pinmemberzexspectrum16-Jun-11 1:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 16 Jun 2011
Article Copyright 2011 by OlegKrivtsov
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid