SatelliteContractVersionAttribute 类


指示 ResourceManager 对象要求附属程序集的特定版本。Instructs a ResourceManager object to ask for a particular version of a satellite assembly.

public ref class SatelliteContractVersionAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false)]
public sealed class SatelliteContractVersionAttribute : Attribute
type SatelliteContractVersionAttribute = class
    inherit Attribute
Public NotInheritable Class SatelliteContractVersionAttribute
Inherits Attribute


桌面应用Desktop Apps

在桌面应用中,SatelliteContractVersionAttribute 属性在主程序集及其所有附属程序集之间建立约定。In desktop apps, the SatelliteContractVersionAttribute attribute establishes a contract between a main assembly and all its satellites. 将此特性应用于主程序集,并向其传递将使用此版本主程序集的附属程序集的版本号。You apply this attribute to your main assembly, and pass it the version number of the satellite assemblies that will work with this version of the main assembly. 当资源管理器(ResourceManager 对象)查找资源时,它会在主程序集上显式加载此属性指定的附属版本。When the resource manager (ResourceManager object) looks up resources, it explicitly loads the satellite version specified by this attribute on the main assembly.

更新主程序集时,将增加其程序集版本号。When you update the main assembly, you increment its assembly version number. 但是,如果现有附属程序集与你的应用程序兼容,则你可能不希望为其交付新副本。However, you might not want to ship new copies of your satellite assemblies if the existing ones are compatible with your app. 在这种情况下,请递增主程序集的版本号,但保留附属协定版本号。In this case, increment the main assembly's version number but leave the satellite contract version number the same. 资源管理器将使用现有附属程序集。The resource manager will use your existing satellite assemblies.

如果要修改附属程序集而不是主程序集,请递增附属程序集的版本号。If you want to revise a satellite assembly but not the main assembly, increment the version number on your satellite. 在这种情况下,将发布发行者策略程序集和附属程序集,指出新的附属程序集可以向后兼容旧的附属程序集。In this case, ship a publisher policy assembly along with your satellite assembly stating that your new satellite assembly has backward compatibility with your old satellite assembly. 资源管理器仍将使用根据 SatelliteContractVersionAttribute 属性写入主程序集的旧合同号;但是,加载程序将绑定到策略程序集指定的附属程序集版本。The resource manager will still use the old contract number written into your main assembly based on the SatelliteContractVersionAttribute attribute; however, the loader will bind to the satellite assembly version that is specified by the policy assembly.

共享组件的供应商使用发行者策略程序集来生成有关发布程序集的特定版本的兼容性声明。A vendor of a shared component uses a publisher policy assembly to make a compatibility statement about a particular version of a released assembly. 发行者策略程序集是强名称程序集,其名称采用格式 policy.<major>.<minor>.<ComponentAssemblyName>,并在中注册。A publisher policy assembly is a strongly named assembly that has a name in the format policy.<major>.<minor>.<ComponentAssemblyName>, and is registered in the . 发行者策略是使用al.exe (程序集链接器)工具从 XML 配置文件(参见)生成的。The publisher policy is generated from an XML configuration file (see the ) by using the Al.exe (Assembly Linker) tool. 程序集链接器与 /link 选项一起使用,以将 XML 配置文件链接到清单程序集,然后将该程序集存储在全局程序集缓存中。The Assembly Linker is used with the /link option to link the XML configuration file to a manifest assembly, which is then stored in the global assembly cache. 当供应商提供了包含 bug 修复的维护版本(Service Pack)时,可以使用发行者策略程序集。The publisher policy assemblies can be used when a vendor ships a maintenance release (service pack) that contains bug fixes.

Windows 8.x 应用商店Windows 8.x Store 应用程序Apps

Windows 8.x 应用商店Windows 8.x Store 应用中将忽略此属性,因为包资源索引(PRI)文件没有版本控制语义。This attribute is ignored in Windows 8.x 应用商店Windows 8.x Store apps, because package resource index (PRI) files do not have versioning semantics. 此外,Windows 8.x 应用商店Windows 8.x Store 打包模型要求所有资源都在同一包中提供,并且不可能重新部署附属程序集或 PRI 文件。In addition, the Windows 8.x 应用商店Windows 8.x Store packaging model requires all resources to ship in the same package, with no possibility of redeploying satellite assemblies or PRI files.



初始化 SatelliteContractVersionAttribute 类的新实例。Initializes a new instance of the SatelliteContractVersionAttribute class.



在派生类中实现时,获取此 Attribute 的唯一标识符。When implemented in a derived class, gets a unique identifier for this Attribute.

(继承自 Attribute)

获取具有所需资源的附属程序集的版本。Gets the version of the satellite assemblies with the required resources.



返回一个值,该值指示此实例是否与指定的对象相等。Returns a value that indicates whether this instance is equal to a specified object.

(继承自 Attribute)

返回此实例的哈希代码。Returns the hash code for this instance.

(继承自 Attribute)

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)

在派生类中重写时,指示此实例的值是否是派生类的默认值。When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(继承自 Attribute)

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(继承自 Attribute)

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)


_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。Maps a set of names to a corresponding set of dispatch identifiers.

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。Retrieves the type information for an object, which can be used to get the type information for an interface.

(继承自 Attribute)

检索对象提供的类型信息接口的数量(0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。Provides access to properties and methods exposed by an object.

(继承自 Attribute)