<publisherPolicy> 元素
指定运行时是否使用发布者策略。
configuration
runtime
<assemblyBinding>
<dependentAssembly>
<publisherPolicy>
语法
<publisherPolicy apply="yes|no"/>
特性和元素
下列各节描述了特性、子元素和父元素。
特性
属性 | 说明 |
---|---|
apply |
指定是否应用发布者策略。 |
apply 属性
值 | 说明 |
---|---|
yes |
应用发布者策略。 这是默认设置。 |
no |
不应用发布者策略。 |
子元素
无。
父元素
元素 | 说明 |
---|---|
assemblyBinding |
包含有关程序集版本重定向和程序集位置的信息。 |
configuration |
公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。 |
dependentAssembly |
封装每个程序集的绑定策略和程序集位置。 为每个程序集使用一个 <dependentAssembly> 元素。 |
runtime |
包含有关程序集绑定和垃圾回收的信息。 |
备注
当组件供应商发布程序集的新版本时,供应商可以包含发布者策略,以便使用旧版本的应用程序现在使用新版本。 若要指定是否对特定的程序集应用发布者策略,请将 <publisherPolicy> 元素置于 <dependentAssembly> 元素中。
apply 属性的默认设置为“是”。 将 apply 属性设置为“否”会替代程序集以前的任何“是”设置。
如果应用程序要在应用程序配置文件中使用 <publisherPolicy apply="no"/> 元素显式忽略发布者策略,则需要这一权限。 通过设置 SecurityPermission 上的 SecurityPermissionFlag 标志授予权限。 有关详细信息,请参阅程序集绑定重定向安全权限。
示例
以下示例关闭程序集 myAssembly
的发布者策略。
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<publisherPolicy apply="no"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
请参阅
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
The .NET documentation is open source. Provide feedback here.
反馈
提交和查看相关反馈