<qualifyAssembly > 元素<qualifyAssembly> Element

指定使用部分名称时应动态加载的程序集全名。Specifies the full name of the assembly that should be dynamically loaded when a partial name is used.

<运行时 ><runtime>


      <qualifyAssembly partialName=  

特性和元素Attributes and Elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.


特性Attribute 描述Description
partialName 必需的特性。Required attribute.

显示在代码中指定的程序集的部分名称。Specifies the partial name of the assembly as it appears in the code.
fullName 必需的特性。Required attribute.

显示在全局程序集缓存中指定的程序集的全名。Specifies the full name of the assembly as it appears in the global assembly cache.

子元素Child Elements


父元素Parent Elements

元素Element 描述Description
assemblyBinding 包含有关程序集版本重定向和程序集位置的信息。Contains information about assembly version redirection and the locations of assemblies.
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有关程序集绑定和垃圾回收的信息。Contains information about assembly binding and garbage collection.


调用Assembly.Load使用部分程序集名称的方法会导致公共语言运行时查找仅在应用程序基目录中的程序集。Calling the Assembly.Load method using partial assembly names causes the common language runtime to look for the assembly only in the application base directory. 使用 <qualifyAssembly > 可提供完整的程序集信息 (名称、 版本、 公钥标记和区域性) 并且使公共语言运行时搜索应用程序配置文件中的元素有关全局程序集缓存中的程序集。Use the <qualifyAssembly> element in your application configuration file to provide the full assembly information (name, version, public key token, and culture) and cause the common language runtime to search for the assembly in the global assembly cache.

FullName属性必须包含程序集标识的四个字段: 名称、 版本、 公钥标记和区域性。The fullName attribute must include the four fields of assembly identity: name, version, public key token, and culture. PartialName属性部分必须引用的程序集。The partialName attribute must partially reference an assembly. 您必须至少指定程序集的文本名称 (最常见的情况),但您还可以包含版本、 公钥标记或区域性 (或四个,但并非所有四个的任意组合)。You must specify at least the assembly's text name (the most common case), but you can also include version, public key token, or culture (or any combination of the four, but not all four). PartialName的调用中指定的名称必须匹配。The partialName must match the name specified in your call. 例如,不能指定"math"作为partialName属性中,配置文件并调用Assembly.Load("math, Version=")在代码中。For example, you cannot specify "math" as the partialName attribute in your configuration file and call Assembly.Load("math, Version=") in your code.


下面的示例以逻辑方式调用变成Assembly.Load("math")Assembly.Load("math,version=,publicKeyToken=a1690a5ea44bab32,culture=neutral")The following example logically turns the call Assembly.Load("math") into Assembly.Load("math,version=,publicKeyToken=a1690a5ea44bab32,culture=neutral").

      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">  
         <qualifyAssembly partialName="math"   

请参阅See also