Directing a VC++ app to use older VC80.CRT version
Categories:
Directing a VC++ Application to Use an Older VC80.CRT Version

Learn how to configure your Visual C++ application to specifically link against an older version of the VC80.CRT runtime, addressing compatibility issues and binding challenges.
When developing or deploying Visual C++ applications, especially those with dependencies on older libraries or systems, you might encounter situations where your application attempts to link against a newer version of the C Runtime Library (CRT) than intended. This can lead to runtime errors, crashes, or unexpected behavior due to version mismatches. This article will guide you through the process of explicitly directing your VC++ application to use an older VC80.CRT
(Visual C++ 2005 Runtime) version, focusing on the techniques to manage this binding effectively.
Understanding CRT Binding and Side-by-Side Assemblies
Visual C++ applications rely on the C Runtime Library (CRT) for fundamental functions. Microsoft introduced a mechanism called 'side-by-side assemblies' (SxS) with Windows XP and Visual Studio 2005 (VC80) to allow multiple versions of the same DLLs (like the CRT) to coexist on a single system without conflicts. This is managed through manifests, which are XML files embedded within executables or deployed alongside them. These manifests specify the exact version of the CRT assembly that an application requires.
When an application starts, the Windows loader reads its manifest to determine which version of the CRT to load. If the manifest specifies VC80.CRT
(Visual C++ 2005), the loader will look for that specific version. Problems arise when an application is built with a newer CRT but has a dependency that was built with an older one, or when the system's available CRT versions don't match the application's manifest.
flowchart TD A[VC++ Application Start] --> B{Read Application Manifest} B --> C{Manifest Specifies CRT Version?} C -->|Yes| D[Load Specified CRT Version] C -->|No| E[Default to System's Latest CRT] D --> F{CRT Version Available?} E --> F F -->|Yes| G[Application Runs Successfully] F -->|No| H[Runtime Error: CRT Not Found/Mismatch]
Flowchart of C Runtime Library (CRT) Loading Process
Forcing an Older VC80.CRT Version
To force your application to use a specific older VC80.CRT
version, you primarily need to manipulate the application's manifest file. This can be done either during the build process or by creating an external manifest file. The key is to ensure the manifest correctly references the desired VC80.CRT
assembly.
1. Modifying the Project Settings (Visual Studio 2005/2008)
For projects built with Visual Studio 2005 or 2008, you can often control the CRT version through project settings. However, if you're trying to use an older VC80.CRT
than what the compiler defaults to, you might need to explicitly specify the manifest details.
2. Using an External Manifest File
This is often the most robust method, especially for applications where you cannot easily recompile or modify the original project settings. You can create an external manifest file (e.g., YourApp.exe.manifest
) and place it in the same directory as your executable. The Windows loader will prioritize this external manifest over any embedded one.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="Microsoft.VC80.CRT"
version="8.0.50727.762"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
Example YourApp.exe.manifest
content for VC80.CRT version 8.0.50727.762
In the example above, version="8.0.50727.762"
specifies a particular build of the Visual C++ 2005 runtime. You need to ensure that this specific version of the VC80.CRT
is installed on the target system. The publicKeyToken
is crucial for identifying the correct Microsoft assembly. This value is standard for Microsoft's CRT assemblies.
3. Embedding the Manifest During Build
If you have control over the build process, you can embed this manifest directly into your executable. In Visual Studio, this is typically handled by the linker. You might need to adjust linker settings to point to a custom manifest file or to override the default manifest generation. For example, using the /MANIFESTFILE
linker option.
VC80.CRT
version is actually present on the target system. If it's not, your application will fail to launch with an error indicating a missing side-by-side configuration. You might need to redistribute the appropriate Microsoft Visual C++ 2005 Redistributable Package.Troubleshooting and Best Practices
When dealing with CRT binding issues, troubleshooting can involve checking several areas:
- Event Viewer: Look for side-by-side errors in the Windows Event Viewer (under 'System' or 'Application' logs). These errors often provide specific details about which assembly version is missing or mismatched.
- SxSTrace.exe: This command-line tool can help diagnose side-by-side assembly loading failures by logging detailed information about manifest parsing and assembly resolution.
- Dependency Walker (depends.exe): While older, this tool can sometimes reveal which DLLs an executable is trying to load and their dependencies, though it doesn't always fully resolve manifest-based SxS issues.
- Redistributable Packages: Ensure the correct Microsoft Visual C++ 2005 Redistributable Package (x86 or x64, depending on your application) is installed on the target machine. This package installs the necessary
VC80.CRT
files and registers their manifests with the system.
1. Identify Required CRT Version
Determine the exact VC80.CRT
version (e.g., 8.0.50727.762
) that your application or its dependencies require. This might involve checking the manifests of the dependent DLLs or the build environment where they were created.
2. Create or Modify Manifest File
Generate an external manifest file (YourApp.exe.manifest
) with the correct assemblyIdentity
for the desired VC80.CRT
version. Place this file in the same directory as your executable.
3. Deploy Redistributable Package
Ensure the target system has the corresponding Microsoft Visual C++ 2005 Redistributable Package installed. This provides the actual VC80.CRT
DLLs and their system-wide manifests.
4. Test and Verify
Run your application and monitor the Event Viewer for any side-by-side errors. Use SxSTrace.exe
if issues persist to get detailed loading logs.
By carefully managing your application's manifest and ensuring the presence of the correct redistributable packages, you can effectively direct your VC++ application to use a specific older VC80.CRT
version, resolving potential compatibility and binding problems.