Partager via


/MANIFESTDEPENDENCY (Specify Manifest Dependencies) 

/MANIFESTDEPENDENCY:manifest_dependency

Remarks

/MANIFESTDEPENDENCY lets you specify attributes that will be placed in the <dependency> section of the manifest file.

See /MANIFEST (Create Side-by-Side Assembly Manifest) for information on how to create a manifest file.

For more information on the <dependency> section of the manifest file, see Publisher Configuration Files.

/MANIFESTDEPENDENCY information can be passed to the linker in one of two ways:

  • Directly on the command line (or in a response file) with /MANIFESTDEPENDENCY.

  • Via the comment pragma.

The following example shows a /MANIFESTDEPENDENCY comment passed via pragma,

#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Test.Research.SampleAssembly' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='0000000000000000' language='*'\"")

which results in the following entry in the manifest file:

  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='Win32' name='Test.Research.SampleAssembly' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='0000000000000000' language='*' />
    </dependentAssembly>
  </dependency>

The same /MANIFESTDEPENDENCY comments can be passed at the command line as follows:

"/manifestdependency:type='Win32' name='Test.Research.SampleAssembly' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='0000000000000000' language='*'\"

The linker will collect /MANIFESTDEPENDENCY comments, eliminate duplicate entries, and then add the resulting XML string to the manifest file. If the linker finds conflicting entries, the manifest file will become corrupt and the application will fail to launch (an entry may be added to the event log, indicating the source of the failure).

To set this linker option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.

  2. Expand the Configuration Properties node.

  3. Expand the Linker node.

  4. Select the Manifest File property page.

  5. Modify the Additional Manifest Dependencies property.

To set this linker option programmatically

See Also

Reference

Setting Linker Options
Linker Options