Deployment methods for Microsoft Visual C + + programs _c language

Source: Internet
Author: User
Tags sha1 win32

1. Programs compiled with Microsoft Visual C + + 6.0, or published in Windows 2000/NT/ME/98 system
Simply by copying MSVCRxx.DLL files to the application directory or system32 directory

2. Programs compiled with Visual Studio 2005 and published in Windows XP and above systems
To reduce the configuration problems raised by DLLs (DLL Hell), the C and C + + runtime is implemented by a parallel (side-by-side) assembly. Simply copying MSVCRxx.DLL is not enough to run a program in a non-development environment, and a CRT DLL must be loaded through a checklist (manifest). If the C run-time library is loaded without this manifest, a R6034 exception is thrown. This is why the CRT DLLs is now located in WinSxS (Windows side-by-side) and not in the System32 directory.

EXE and DLL files will have a manifest file that illustrates dependencies, which, when compiled with Visual Studio 2005, automatically produces manifest files with the same name as the executable file, such as:
App.exe//executable file
App.exe.manifest//DLL dependent files
In general, the EXE and DLL manifest files will be embedded in the EXE and DLL files, the external manifest can be deleted. Such as:
Mt.exe/nologo/manifest ". \app.exe.manifest"/outputresource: ". \app.exe"; 1
In the EXE file, the last face value is 1, in the DLL file, the value is 2
The manifest file is not embedded in the Microsoft Visual C + + Run-time Library DLL file, so external manifest files are required, Visual Studio Manifest, 2005, is named Microsoft.vc80.crt.manifest,visual Studio. 2008 of the manifest name is Microsoft.VC90.CRT.manifest, so to be microsoft.vc80.crt.manifest,msvcr80.dll,msvcp80.dll, MSVCM80.dll these four files to the application directory. Such as
C:\Test\app.exe
C:\Test\MSVCR80.dll
C:\Test\MSVCP80.dll
C:\Test\MSVCM80.dll
C:\Test\Microsoft.VC80.CRT.Manifest
Or use Microsoft's official recommendations, such as:
Above the WinXP
C:\Test\app.exe
C:\Test\Microsoft.VC80.CRT\Microsoft.VC80.CRT.manifest
C:\Test\Microsoft.VC80.CRT\msvcr80.dll
C:\Test\Microsoft.VC80.CRT\msvcp80.dll
C:\Test\Microsoft.VC80.CRT\msvcm80.dll
Below the Win2K
C:\Test\app.exe
C:\Test\msvcr80.dll
C:\Test\msvcp80.dll
C:\Test\msvcm80.dll
If you do not use the above method, you can see that Microsoft Visual C + + has multiple versions of DLLs in the system that are used by programs that do not match the published Microsoft Visual C + + DLL, such as:
App. Manifest file that requires a Microsoft.VC90.CRT DLL, and the version is 9.0.21022.8

Copy Code code as follows:

<?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.VC90.CRT ' version= ' 9.0.21022.8 's ' processorarchitecture= ' publickeytoken= ' 1fc8b3b9a1e18e3b '/>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyidentity type= ' Win32 ' Name= ' Microsoft.windows.common-controls ' version= ' 6.0.0.0 ' = ' x86 ' publickeytoken= ' 6595b64144ccf1df ' language= ' * '/>
</dependentAssembly>
</dependency>
</assembly>

Microsoft.VC90.CRT.manifest file, indicating that it is Microsoft.VC90.CRT, but the version is 9.0.30729.1

Copy Code code as follows:

<?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.VC90.CRT" version= "9.0.30729.1" processorarchitecture= "x86" Publickeytoken= "1FC8B3B9A1E18E3B" ></assemblyIdentity>
    <file name= "Msvcr90.dll" hashalg= "SHA1" hash= "9785B1C493DEB5B2134DC4AEF3719CEE207001BC" > <asmv2:hash xmlns:asmv2= "Urn:schemas-microsoft-com:asm.v2" xmlns:dsig= "http://www.w3.org/2000/09/xmldsig#" ><dsig:transforms><dsig:transform algorithm= "Urn:schemas-microsoft-com:hashtransforms.identity" > </dsig:transform></dsig:transforms><dsig:digestmethod algorithm= "http://www.w3.org/2000/09/ XMLDSIG#SHA1 "></dsig:digestmethod><dsig:digestvalue>vf5ecuahpv7enuf+/uixmpizpvs=</dsig:d Igestvalue></asmv2:hash></file><file name= "Msvcp90.dll" hashalg= "SHA1" 0f6bbf7fe4fb3fca2cb5b542eca1a1cad051f01c "><asmv2:hash xmlns:asmv2=" Urn:schemas-microsoft-com:asm.v2 "xmlns :d sig= "http://www.w3.org/2000/09/xmldsig#" ><dsig:transforms><dsig:transform algorithm= urn: Schemas-microsoft-com:hashtransforms.identity "></dsig:transform></dsig:transforms><dsig:d Igestmethod algorithm= "http://www.w3.oRG/2000/09/XMLDSIG#SHA1 "></dsig:DigestMethod><dsig:DigestValue>3Wg+StVMq2uhx7POnAkl2w4dDmY=< /dsig:digestvalue></asmv2:hash></file><file name= "Msvcm90.dll" hashalg= "SHA1" 7F3290AB2B7444C2B4A9B1FEDFDB16466D7A21BB "><asmv2:hash xmlns:asmv2=" Urn:schemas-microsoft-com:asm.v2 "xmlns :d sig= "http://www.w3.org/2000/09/xmldsig#" ><dsig:transforms><dsig:transform algorithm= urn: Schemas-microsoft-com:hashtransforms.identity "></dsig:transform></dsig:transforms><dsig:d Igestmethod algorithm= "HTTP://WWW.W3.ORG/2000/09/XMLDSIG#SHA1" ></dsig:digestmethod><dsig:d Igestvalue>/yfrn7uqenzdmeomhxtgdrmioba=</dsig:digestvalue></asmv2:hash></file>
</assembly>


The two versions are inconsistent, causing the program to not run, and the solution is to release the 9.0.21022.8 version of the Microsoft.VC90.CRT file required by the program

3. There is also an easy way to install Visual C + + 2008 Redistributable Package (x86) or (x64) on machines that need to be deployed.

Note:

Open the exe you want to publish with dependency Walker (Depends.exe), and find the DLL in the system that you want to rely on from the list in the upper-left corner

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.