包代码Package Codes

包代码是用于标识特定 Windows Installer 的 GUID。The package code is a GUID identifying a particular Windows Installer package. 包代码将 .msi 文件与应用程序或产品关联起来,并且还可用于验证源。The package code associates an .msi file with an application or product and can also be used for the verification of sources. 产品和包代码不可互换。The product and package codes are not interchangeable. 有关详细信息,请参阅 产品代码For details, see Product Codes.

Nonidentical 文件不应具有相同的包代码。Nonidentical .msi files should not have the same package code. 更改包代码很重要,因为它是安装程序用于搜索和验证给定安装的正确包的主要标识符。It is important to change the package code because it is the primary identifier used by the installer to search for and validate the correct package for a given installation. 如果更改了包而未更改包代码,则在安装程序仍可访问这两个包时,安装程序可能不会使用较新的包。If a package is changed without changing the package code, the installer may not use the newer package if both are still accessible to the installer.

包代码存储在 摘要信息流的 "修订号摘要" 属性中。The package code is stored in the Revision Number Summary Property of the Summary Information Stream. 请注意,产品代码和包代码 Guid 中的字母必须大写。Note that letters in product code and package code GUIDs must be uppercase. GUIDGEN.EXE 等实用工具生成包含小写字母的 Guid。Utilities such as GUIDGEN generate GUIDs containing lowercase letters. 必须将这些 Guid 中的小写字母更改为大写字母,才能用作产品代码或包代码。The lowercase letters in these GUIDs must be changed to uppercase to be used as a product code or package code.

尽管交付的应用程序具有相同的包代码和产品代码,但在更新应用程序时,这两个值可能会分离。Although it is common to ship an application that has the same package code and product code, the two values can diverge as the application is updated. 例如,如果应用程序包含一个新文件,则需要更新安装数据库以安装该文件。For example, including a new file with the application would require updating the installation database to install the file. 如果更改很重要,开发人员可能会选择不更改产品代码,但需要使用不同的 .msi 文件来安装新文件,因此包代码必须递增。If the changes are minor a developer may choose not to change the product code, however, a different .msi file is needed to install the new file and so the package code must be incremented. 相反,单个包可用于安装多个产品。Conversely, a single package can be used to install more than one product. 例如,在没有语言转换的情况下安装包可能会安装英语版的应用程序,并且使用语言转换安装同一包可能会安装法语版本。For example, the installation of a package without a language transform could install the English version of the application and the installation of the same package with a language transform could install the French version. 转换不同于确定包代码的 .msi 文件。The transform is distinct from the .msi file that determines the package code. 英语和法语版本可能具有不同的产品代码和相同的包代码,因为它们均使用相同的 .msi 文件进行安装。The English and French versions could have different product codes and the same package code because they are both installed with the same .msi file.