<dependency> Element (ClickOnce Deployment)
Updated: July 2008
Identifies the version of the application to install, and the location of the application manifest.
<dependency> <dependentAssembly preRequisite visible dependencyType codeBase size > <assemblyIdentity name version publicKeyToken processorArchitecture language type /> <hash> <dsig:Transforms> <dsig:Transform Algorithm /> </dsig:Transforms> <dsig:DigestMethod /> <dsig:DigestValue> </dsig:DigestValue> </hash> </dependentAssembly> </dependency>
The dependency element is required. It has no attributes. A deployment manifest can have multiple dependency elements.
The dependency element usually expresses dependencies for the main application on assemblies contained within a ClickOnce application. If your Main.exe application consumes an assembly called DotNetAssembly.dll, then that assembly must be listed in a dependency section. Dependency, however, can also express other types of dependencies, such as dependencies on a specific version of the common language runtime, on an assembly in the global assembly cache (GAC), or on a COM object. Because it is a no-touch deployment technology, ClickOnce cannot initiate download and installation of these types of dependencies, but it does prevent the application from running if one or more of the specified dependencies do not exist.
Required. This element contains the assemblyIdentity element. The following table shows the attributes the dependentAssembly supports.
Optional. Specifies that this assembly should already exist in the GAC. Valid values are true and false. If true, and the specified assembly does not exist in the GAC, the application fails to run.
Required. Identifies the top-level application identity, including its dependencies. Used internally by ClickOnce to manage application storage and activation.
Required. The relationship between this dependency and the application. Valid values are:
Optional. The full path to the application manifest.
Optional. The size of the application manifest, in bytes.
Required. This element is a child of the dependentAssembly element. The content of assemblyIdentity must be the same as described in the ClickOnce application manifest. The following table shows the attributes of the assemblyIdentity element.
Required. Identifies the name of the application.
Required. Specifies the version number of the application, in the following format: major.minor.build.revision
Required. Specifies a 16-character hexadecimal string that represents the last 8 bytes of the SHA-1 hash of the public key under which the application or assembly is signed. The public key used to sign must be 2048 bits or greater.
Required. Specifies the microprocessor. The valid values are x86 for 32-bit Windows and IA64 for 64-bit Windows.
Optional. Identifies the two part language codes of the assembly. For example, EN-US, which stands for English (U.S.). The default is neutral. This element is in the asmv2 namespace.
Optional. For backwards compatibility with Windows side-by-side install technology. The only allowed value is win32.
The hash element is an optional child of the file 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. If the hash element is not included, this check will not be performed. Therefore, omitting the hash element is not recommended.
The dsig:Transform element is a required child of the dsig:Transforms element. The following table shows the attributes of the dsig:Transform element.
The algorithm used to calculate the digest for this file. Currently the only value used by ClickOnce is urn:schemas-microsoft-com:HashTransforms.Identity.
The dsig:DigestMethod element is a required child of the hash element. The following table shows the attributes of the dsig:DigestMethod element.
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.
The following code example shows a dependency element in a ClickOnce deployment manifest. This code example is part of a larger example provided for the ClickOnce Deployment Manifest topic.
<!-- Identify the assembly dependencies --> <dependency> <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="MyApplication.exe" size="16384"> <assemblyIdentity name="MyApplication" version="0.0.0.0" cultural="neutral" processorArchitecture="msil" /> <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>YzXYZJAvj9pgAG3y8jXUjC7AtHg=</dsig:DigestValue> </hash> </dependentAssembly> </dependency>
The following code example specifies a dependency on an assembly already installed in the GAC.
<dependency> <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true"> <assemblyIdentity name="GACAssembly" version="220.127.116.11" language="neutral" processorArchitecture="msil" /> </dependentAssembly> </dependency>
The following code example specifies a dependency on a specific version of the common language runtime.
<dependency> <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true"> <assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="2.0.50215.0" /> </dependentAssembly> </dependency>
The following code example specifies an operating system dependency.
<dependency> <dependentOS supportUrl="http://www.microsoft.com" description="Microsoft Windows Operating System"> <osVersionInfo> <os majorVersion="4" minorVersion="10" /> </osVersionInfo> </dependentOS> </dependency>