1. Programs compiled with Microsoft Visual C++ 6.0, or published on Windows 2000/NT/ME/98 system
Just copy the file to the application directory or system32 directory
2. Programs compiled with Visual Studio 2005 or above and published on Windows XP and above systems
In order to reduce configuration problems caused by DLL (DLL hell), the C and C++ runtimes are implemented by parallel (Side-by-Side) assembly. Copying alone is not enough to run the program normally in a non-development environment. The CRT DLL must be loaded through a manifest. If this list is not available when loading the C runtime library, an R6034 exception will be raised. This is why CRT DLLs are now located in WinSXS (Windows Side-by-Side) and not in the System32 directory.
Both EXE and DLL files have a manifest file, which explains the dependency. After compiling with Visual Studio 2005, a manifest file with the same name as the executable file will be automatically generated, such as:
// Executable file
// dll dependency file
Generally speaking, the manifest files of EXE and DLL will be embedded in the EXE and DLL files, and the external manifest can be deleted. like:
/nologo /manifest ".\" /outputresource:".\";1
In the EXE file, the last value is 1, and in the DLL file, the value is 2
The Microsoft Visual C++ runtime DLL file does not have a manifest file embedded, so an external manifest file is needed. The manifest name of Visual Studio 2005 is Microsoft., and the manifest name of Visual Studio 2008 is Microsoft., so you need to copy these four files to the application directory. like
C:\Test\
C:\Test\
C:\Test\
C:\Test\
C:\Test\Microsoft.
Or use official Microsoft recommendations, such as:
On WinXP or above
C:\Test\
C:\Test\Microsoft.\Microsoft.
C:\Test\Microsoft.\
C:\Test\Microsoft.\
C:\Test\Microsoft.\
Below Win2K
C:\Test\
C:\Test\
C:\Test\
C:\Test\
If the above method still cannot be executed, it means that Microsoft Visual C++ has multiple versions of DLLs in the system. The program uses the Microsoft Visual C++ DLLs that are released do not match, such as:
File, requires Microsoft. DLL, and version 9.0.21022.8
<?xml version='1.0'encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false'/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.'version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'/>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='-Controls'version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'/>
</dependentAssembly>
</dependency>
</assembly>
Microsoft. file, specified as Microsoft., but version 9.0.30729.1
<?xml version="1.0"encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable></noInheritable>
<assemblyIdentity type="win32" name="Microsoft."version="9.0.30729.1" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
<file name="" hashalg="SHA1" hash="9785b1c493deb5b2134dc4aef3719cee207001bc"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http:///2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http:///2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>VF5ECUAHPV7EnUf+/UIXMPizPvs=</dsig:DigestValue></asmv2:hash></file><file name="" hashalg="SHA1" hash="0f6bbf7fe4fb3fca2cb5b542eca1a1cad051f01c"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http:///2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http:///2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>3Wg+StVMq2uhx7POnAkl2w4dDmY=</dsig:DigestValue></asmv2:hash></file><file name="" hashalg="SHA1" hash="7f3290ab2b7444c2b4a9b1fedfdb16466d7a21bb"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http:///2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http:///2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>/YfRn7UQENzdMeoMHxTgdRMiObA=</dsig:DigestValue></asmv2:hash></file>
</assembly>
The versions of the two are inconsistent, which causes the program to fail to run. The solution is to release the Microsoft file for version 9.0.21022.8 required by the program.
3. Another simple way is to install Visual C++ 2008 Redistributable Package (x86) or (x64) on the machine that needs to be deployed.
Note:
Use Dependency Walker() to open the EXE to be published, and find the DLLs to depend on in the system from the list in the upper left corner