One-minute explicit vs manifest Principle

Source: Internet
Author: User

What is the manifest file of the vs program?

Manifest is a list of dependent side-by-side components, such as ATL and CRT.

Why is there a manifest file?

On a PC, there are usually more than one version number (C:/Windows/winsxs or in the system folder) when a program is loaded, therefore, the manifest file is used to specify.

Where and how to create a manifest.

Suppose vs is used for development, you can set to manually create manifest by using porperty-> Configuration properties-> linker-> manifest file-> Generate manifest to yes to specify the system and CRT assembly version.

In addition to the external manifest file, the embedded manifest information can be written to the generated binary file.

Set porperty-> Configuration properties-> manifest tool-> embed manifest to Yes

For Windows Versions earlier than XP, external manifest has a higher priority than embed manifest, but for Windows Server and later versions, the opposite is true.

Why does my manifest clearly indicate

Name = "Microsoft. vc80.debugcrt" version = "8.0.50608.0 ",

The depends.exe tool can be used, but we found that 8.00.50727.42 is referenced?

In C:/Windows/winsxs/policies, a publisher configuration file is also called a policy file. For example, the 8.0.50727.42.policy file redirects the dependency:

<Dependentassembly>
<Assemblyidentity type = "Win32" name = "Microsoft. vc80.debugcrt" processorarchitecture = "IA64" publickeytoken = "1fc8b3b9a1e18e3b"/>
<Bindingredirect oldversion = "8.0.41204.256-8.0.50608.0" newversion = "8.0.50727.42"/>
</Dependentassembly>

Specify that "8.0.41204.256-8.0.50608.0" is directed to 8.0.50727.42. This is a solution provided by the Assembly provider, such as MS, to fix low-level version bugs. In addition, you can use the application config file to redirect the assembly of the program. For example, in your bin local directory yourbin. extention. config:

<Configuration>
<Windows>
<Assemblybinding xmlns = "urn: Schemas-Microsoft-com: ASM. V1">
<Dependentassembly>
<Assemblyidentity type = "Win32" name = "Microsoft. vc80.atl" processorarchitecture = "x86" publickeytoken = "1fc8b3b9a1e18e3b"> </assemblyidentity>
<Bindingredirect oldversion = "8.0.41204.256-8.0.50608.0" newversion = "8.0.50727.42"/>
</Dependentassembly>
<Dependentassembly>
<Assemblyidentity type = "Win32" name = "Microsoft. vc80.debugcrt" processorarchitecture = "x86" publickeytoken = "1fc8b3b9a1e18e3b"/> </assemblyidentity>
<Bindingredirect oldversion = "8.0.41204.256-8.0.50608.0" newversion = "8.0.50727.42"/>
</Dependentassembly>
</Assemblybinding>
</Windows>
</Configuration>

How does one determine the assembly version number specified by the manifest information of my program?

In the Assembly header file, the Assembly version number is specified. Such as crtassem. h.

# Ifndef _ crt_assembly_version
# DEFINE _ crt_assembly_version "8.0.50608.0"
# Endif

You can change 8.0.50608.0 to 8.0.50727.42 to generate the desired manifest information.

What if I want to publish my program as an Independent Assembly (isolated application) without relying on the system assembly of the target PC?

Take the dependent assembly and the corresponding manifest file (C:/Windows/winsxs) with it. Note that the manifest information must be directly specified to the attached assembly DLLs, you do not need to rely on policy redirection.

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.