Partager via


<dependency> Element (ClickOnce Reference)

Identifies a platform or assembly dependency that is required for the application.

<dependency>
   <dependentOS
      supportURL
      description
   >
      <osVersionInfo>
         <os
            majorVersion
            minorVersion
            buildNumber
            servicePackMajor
            servicePackMinor
            productType
            suiteType
         /> 
      </osVersionInfo>
   </dependentOS>
   <dependentAssembly
      codeBase
      size
   >
      <assemblyIdentity
         name
         version
         processorArchitecture
         language
      >
         <hash>
            <dsig:Transforms>
               <dsig:Transform
                  Algorithm
            />
            </dsig:Transforms>
            <dsig:DigestMethod />
            <dsig:DigestValue>
            </dsig:DigestValue>
    </hash>

      </assemblyIdentity>
   </dependentAssembly>
</dependency>

Elements and Attributes

The dependency element is required. There may be multiple instances of dependency in the same application manifest.

The dependency element has no attributes, and contains the following child elements.

dependentOS

Optional. Contains the osVersionInfo element. The dependentOS and dependentAssembly elements are mutually exclusive: one or the other must exist for a dependency element, but not both.

dependentOS supports the following attributes.

Attribute Description

supportUrl

Optional. Specifies a support URL for the dependent platform. This URL is shown to the user if the required platform is found.

description

Optional. Describes, in human-readable form, the operating system described by the dependentOS element.

osVersionInfo

Required. This element is a child of the dependentOS element and contains the os element. This element has no attributes.

os

Required. This element is a child of the osVersionInfo element. This element has the following attributes.


Attribute Description

majorVersion

Required. Specifies the major version number of the OS.

minorVersion

Required. Specifies the minor version number of the OS.

buildNumber

Required. Specifies the build number of the OS.

servicePackMajor

Required. Specifies the service pack major number of the OS.

servicePackMinor

Optional. Specifies the service pack minor number of the OS.

productType

Optional. Identifies the product type value. Valid values are server, workstation, and domainController. For example, for Windows 2000 Professional, this attribute value is workstation.

suiteType

Optional. Identifies a product suite available on the system, or the system's configuration type. Valid values are backoffice, blade, datacenter, enterprise, home, professional, smallbusiness, smallbusinessRestricted, and terminal. For example, for Windows 2000 Professional, this attribute value is professional.

dependentAssembly

Optional. Contains the assemblyIdentity element. The dependentOS and dependentAssembly elements are mutually exclusive: one or the other must exist for a dependency element, but not both.

dependentAssembly has the following attributes.

Attribute Description
codeBase

Required. The path to the assembly represented by this assembly. May be either an absolute path, or a path relative to the manifest's code base. This path must be a valid URI in order for the assembly manifest to be valid.

size

Required. The size of the dependent assembly, in bytes.

assemblyIdentity

Required. This element is a child of the dependentAssembly element and has the following attributes.


Attribute Description

name

Required. Identifies the name of the application.

version

Required. Specifies the version number of the application in the following format: major.minor.build.revision

publicKeyToken

Optional. Specifies a 16-character hexadecimal string that represents the last 8 bytes of the SHA-1 hash value of the public key under which the application or assembly is signed. The public key used to sign the catalog must be 2048 bits or more.

processorArchitecture

Optional. Specifies the processor. The valid values are x86 for 32-bit Windows and I64 for 64-bit Windows.

language

Optional. Identifies the two part language codes, such as EN-US, of the assembly.

hash

The hash element is a required child of the assemblyIdentity element. The hash element has no attributes.

ClickOnce uses an algorithmic hash of all the files in an application as a security check, to ensure that none of the files were changed after deployment.

dsig:Transforms

The dsig:Transforms element is a required child of the hash element. The dsig:Transforms element has no attributes.

dsig:Transform

The dsig:Transform element is a required child of the dsig:Transforms element. The dsig:Transform element has the following attributes.

Attribute Description

Algorithm

The algorithm used to calculate the digest for this file. Currently the only value used by ClickOnce is urn:schemas-microsoft-com:HashTransforms.Identity.

dsig:DigestMethod

The dsig:DigestMethod element is a required child of the hash element. The dsig:DigestMethod element has the following attributes.

Attribute Description

Algorithm

The algorithm used to calculate the digest for this file. Currently the only value used by ClickOnce is http://www.w3.org/2000/09/xmldsig#sha1.

dsig:DigestValue

The dsig:DigestValue element is a required child of the hash element. The dsig:DigestValue element has no attributes. Its text value is the computed hash for the specified file.

Remarks

All assemblies used by your application must have a corresponding dependency element. Dependent assemblies do not include assemblies that must be preinstalled in the global assembly cache as platform assemblies.

Example

The following code example illustrates dependency elements in a ClickOnce application manifest. This code example is part of a larger example provided for the ClickOnce Application Manifest topic.

<!-- This XML identifies a SpellingChecker assembly. -->
<dependency>
  <dependentAssembly codebase="SpellingChecker.dll" size="29696">
    <assemblyIdentity name="SpellingChecker" version="2.0.0.0" publicKeyToken="e8ed396099c4b4e9" processorArchitecture="msil" language="es-PE" />
    <hash>
      <dsig:Transforms>
        <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
      </dsig:Transforms>
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <dsig:DigestValue>2+33lqQoPphgov907Kfp1v4TZMw=</dsig:DigestValue>
    </hash>
  </dependentAssembly>
</dependency>

<!-- This XML describes an operating system dependency for the application. -->
<!--Microsoft Windows Operating System Platform Dependency-->
<dependency>
  <dependentOS supportUrl="https://www.microsoft.com" description="Microsoft Windows Operating System">
    <osVersionInfo>
      <os majorVersion="4" minorVersion="10" />
    </osVersionInfo>
  </dependentOS>
</dependency>

See Also

Reference

ClickOnce Application Manifest