共用方式為


Version Numbers for Main and Localized Satellite Assemblies

The SatelliteContractVersionAttribute class provides versioning support for a main assembly that uses localized resources by means of the resource manager. Applying the SatelliteContractVersionAttribute to an application's main assembly allows you to update and re-deploy the assembly without updating its satellite assemblies. For example, you can use the SatelliteContractVersionAttribute class with a service pack that doesn't introduce new resources without rebuilding and redeploying your satellite assemblies. For your localized resources to be available, the satellite contract version of your main assembly must match the AssemblyVersionAttribute class of your satellite assemblies. You must specify an exact version number in the SatelliteContractVersionAttribute; wildcard characters such as "*" are not allowed. For more information, see 擷取桌面應用程式中的資源.

Updating Assemblies

The SatelliteContractVersionAttribute class allows you to update a main assembly without having to update your satellite assembly, or vice versa. When the main assembly is updated, its assembly version number is changed. If you want to continue using the existing satellite assemblies, change the main assembly's version number but leave the satellite contract version number the same. For example, in your first release your main assembly version may be 1.0.0.0. The satellite contract version and the assembly version of the satellite assembly will also be 1.0.0.0. If you need to update your main assembly for a service pack, you can change the assembly version to 1.0.0.1, while keeping the satellite contract version and the satellite's assembly version as 1.0.0.0.

If you need to update a satellite assembly but not your main assembly, you change the AssemblyVersionAttribute of the satellite assembly. Along with your satellite assembly, you will have to ship a policy assembly that states that your new satellite assembly is compatible with your old satellite assembly. For more information on policies, see How the Runtime Locates Assemblies.

The following code shows how to set the satellite contract version. The code can be placed in either a build script or in the AssemblyInfo.vb or AssemblyInfo.cs file.

<Assembly: SatelliteContractVersionAttribute("4.3.2.1")>
[assembly: SatelliteContractVersionAttribute("4.3.2.1")]

請參閱

概念

執行階段如何找出組件

設定組件屬性

Security and Localized Satellite Assemblies

其他資源

Localizing Applications

Globalizing and Localizing Applications