This article reprinted Source: http://blog.csdn.net/fanchuan0077/article/details/5627218 one minute understand vs manifest Principle
Respect the labor achievements of the original author, and indicate the source for reprinting or reference.
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 (C:/Windows/winsxs or under the system directory) in a single build. When a program is loaded, I do not know which one to load, therefore, the manifest file is used to specify.
Where and how to create a manifest.
If you use vs for development, you can use porperty-> Configuration properties-> linker-> manifest file-> Generate manifest to yes to automatically create manifest to specify the system and CRT Assembly versions.
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 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 ",
However, the depends.exe tool is used to find 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 bugs in low-level versions. In addition, you can use the application config file to redirect the assembly of the program. For example, in your bin local folder 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 do I determine the assembly version specified by the manifest information of my program?
In the Assembly header file, the Assembly version information is specified. Such as crtassem. h.
# Ifndef _ crt_assembly_version
# DEFINE _ crt_assembly_version "8.0.50608.0"
# Endif
You can modify 8.0.50608.0 to 8.0.50727.42 to generate the desired manifest information.
What should I do if I want to publish my program as an Independent Assembly (isolated application) without relying on the system assembly of the target PC?
Add all dependent assemblies and corresponding manifest files (C:/Windows/winsxs). Note that the manifest information must be specified directly to the included Assembly DLLs, you do not need to rely on policy redirection.