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

By , 16 Jun 2011
 
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

zexspectrum
Russian Federation Russian Federation
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralWhat is the best solution when I have two modules in the sam...memberMojoturner28 Jul '11 - 7:12 

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

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 16 Jun 2011
Article Copyright 2011 by zexspectrum
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid