Deploy the vc2008 development program (three ways, but I think this is the most difficult way)

Source: Internet
Author: User

If you compile a VC2008 default CRT/MFC application, if the target deployment computer does not have the corresponding VC2008 dynamic library installed, when you run your program, the following error message appears. This is because the program uses a dynamic library version of the VC2008-based CRT/MFC. There are three ways to solve this problem:
1. Compile with static link library (the drawback is that the program that generated the EXE is too large) 2. Use Vcredist_x86.exe/vcredist_x64.exe to install VC2008 's release DLL on your system. (Disadvantage, only support the release version, debug version of the program can not support) 3. Publish the CRT/MFC dynamic library that your program relies on with your program (placed in the same directory as your publisher)
The first and second are not detailed how to achieve, as long as the third method how to achieve. In particular, program development is a program developed using the VC2008 SP1 version. There are two directories in your VC2008 installation directory,
    • C:\Program Files (x86) \microsoft Visual Studio 9.0\VC\REDIST\X86\MICROSOFT.VC90.CRT
    • C:\Program Files (x86) \microsoft Visual Studio 9.0\vc\redist\x86\microsoft.vc90.mfc

Simply copy the files under both directories to the same directory as the Publisher:

Microsoft.VC90.CRT.manifest
Msvcr90.dll
Msvcp90.dll
Msvcm90.dll
Microsoft.VC90.MFC.manifest
Mfc90.dll
Mfc90u.dll
Mfcm90.dll
Mfcm90u.dll
These are the release version of this program depends on the dynamic library, in the same way, if it is a debug version of the publisher, but also the corresponding debug dynamic library copy to the appropriate directory. The program will run as you like! However, if you install the VC2008 SP1 version, the problem comes, and your program won't work! The reason is that when the VC2008 SP1 was installed, it replaced "vc/redist" with a new version of the file, the problem is small, but the version of the program is dependent on the new manifest file, when you compile the VC2008-SP1 program, It also writes Rtm-version to the program's manifest file, which is the old rtm-version, not consistent with the new version of the Vc2008-sp1 "CRT/MFC" manifest version, So when the program is running, it refuses to import the crt/mfc of these new VC2008-SP1! There are two ways to resolve this.
    • Method One:
The simplest, modify the Microsoft.VC90.CRT.manifest and Microsoft.VC90.MFC.manifest files, change the new version number to the old version number, if it is dependent on the other microsoft.vc90.*. Manifest file is also so modified! If the VC2008-SP1 is installed, its version number is "9.0.21022.8" before the 9.0.21022.8″ is not installed VC2008-SP1 the process is as follows: will be dependent on the dynamic library and their The manifest file is copied to the same directory as the publishing application, and the Microsoft.vc90.*.manifest file is modified , version= "9.0.30729.1"
Revision changed to
version= "9.0.21022.8"
Congratulations, your program is up and running!
    • Method Two
      Modify the manifest on which your program depends, so that the program will be based on the new manifest.
      The process is as follows:
      In stdafx.h
      In this file, add the following macro definition:
#define _bind_to_current_vclibs_version 1
After the program compiles, it relies on the new manifest, and the version number "9.0.30729.1" does not need to modify the version number in the manifest file.
Copy the dependent dynamic libraries and their manifest files to the same directory as the publishing application
Congratulations, the program is up and running again!
Note: If you are looking for new mfc-feature-pack features, this is the best way to do it. It is important to note that if you have installed the Vcredist_*.exe package, note that the DLL will automatically transfer the reference to the WinSxS directory under the system directory, That is, no longer referencing a dynamic library under the same directory!
If the compile-time (/clr) compilation option is used to support. NET development, you must install the. NET Framework Redistributable Package! However, in 2010, the compiled program will no longer need the manifest file!

http://blog.csdn.net/kl222/article/details/7546076

Deploy the vc2008 development program (three ways, but I think this is the most difficult way)

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.