修改包发布者脚本Modify package publisher script

.MSIX 工具包中的Modify package publisher 脚本可用于更新清单中的发布服务器,然后再根据新证书对包进行重新签名。The Modify package publisher script in the MSIX Toolkit can be used to update the publisher in the manifest before re-signing the package based on a new certificate. 此脚本当前限制为 .MSIX 应用,而不是 .MSIX 捆绑包。This script is currently limited to MSIX apps, and not MSIX bundles.

语法Syntax

.\modify-package-publisher.ps1 -directory <String> -redist <String> -certPath <String> [[-pfxPath] <String>] [[-Password] <String>] [[-forceContinue]<Switch>]

示例Examples

根据证书更新发布服务器Update the publisher based on the certificate

PS C:\> .\modify-package-publisher.ps1 -directory "C:\MSIX" -redist "C:\MSIX-Toolkit\Redist" -certPath "C:\cert\mycert.cer"

此命令以递归方式搜索所有 .MSIX 包的 C:\MSIX 的内容,并更新 .MSIX 应用发行者,使其与位于 C:\cert\mycert.cer. 的证书发布者匹配。This command recursively searches the contents of C:\MSIX for all MSIX packages and updates the MSIX app publisher to match the publisher of the certificate located at C:\cert\mycert.cer. 不支持使用 SHA1 证书对 .MSIX 包格式应用程序进行签名。Signing an MSIX package format application with a SHA1 certificate is unsupported.

更新发布服务器并对 .MSIX 应用进行签名Update the publisher and sign the MSIX app

PS C:\> .\modify-package-publisher.ps1 -directory "C:\MSIX" -redist "C:\MSIX-Toolkit\Redist" -certPath "C:\cert\mycert.cer" -pfxPath "C:\cert\CertKey.pfx"

此命令以递归方式搜索所有 .MSIX 包的 C:\MSIX 的内容,并更新 .MSIX 应用发行者,使其与位于 C:\cert\mycert.cer. 的证书发布者匹配。This command recursively searches the contents of C:\MSIX for all MSIX packages and updates the MSIX app publisher to match the publisher of the certificate located at C:\cert\mycert.cer. 然后,该命令使用位于 C:\cert\CertKey.pfx. 的证书重新签名已标识的 .MSIX 包。Then, the command re-signs the identified MSIX packages using the certificate located at C:\cert\CertKey.pfx. 不支持使用 SHA1 证书对 .MSIX 包格式应用程序进行签名。Signing the MSIX package format application with a SHA1 certificate is unsupported.

更新发布服务器并使用受密码保护的 PFX 证书对 .MSIX 应用进行签名Update the publisher and sign the MSIX app with a password-protected PFX certificate

PS C:\> .\modify-package-publisher.ps1 -directory "C:\MSIX" -redist "C:\MSIX-Toolkit\Redist" -certPath "C:\cert\mycert.cer" -pfxPath "C:\cert\CertKey.pfx" -password "aaabbbccc"

此命令以递归方式搜索所有 .MSIX 包的 C:\MSIX 的内容,并更新 .MSIX 应用发行者,使其与位于 C:\cert\mycert.cer. 的证书发布者匹配。This command recursively searches the contents of C:\MSIX for all MSIX packages and updates the MSIX app publisher to match the publisher of the certificate located at C:\cert\mycert.cer. 然后,该命令使用 C:\cert\CertKey.pfx 上的证书对已标识的 .MSIX 包重新签名,并使用 password aaabbbccc解锁受密码保护的证书。Then, the command re-signs the identified MSIX packages using the certificate located at C:\cert\CertKey.pfx using the password aaabbbccc to unlock the password protected certificate. 不支持使用 SHA1 证书对 .MSIX 包格式应用程序进行签名。Signing the MSIX package format application with a SHA1 certificate is unsupported.

更新发布服务器,对 .MSIX 应用进行签名,并强制继续下一个 .MSIX 应用Update the publisher, sign the MSIX app, and force continue to next MSIX app

PS C:\> .\modify-package-publisher.ps1 -directory "C:\MSIX" -redist "C:\MSIX-Toolkit\Redist" -certPath "C:\cert\mycert.cer" -pfxPath "C:\cert\CertKey.pfx" -forceContinue -pfxPath "C:\cert\CertKey.pfx"

此命令以递归方式搜索所有 .MSIX 包的 C:\MSIX 的内容,并更新 .MSIX 应用发行者,使其与位于 C:\cert\mycert.cer. 的证书发布者匹配。This command recursively searches the contents of C:\MSIX for all MSIX packages and updates the MSIX app publisher to match the publisher of the certificate located at C:\cert\mycert.cer. 然后,该命令使用位于 C:\cert\CertKey.pfx. 的证书重新签名已标识的 .MSIX 包。Then, the command re-signs the identified MSIX packages using the certificate located at C:\cert\CertKey.pfx. 如果在处理 .MSIX 包时出现任何错误,脚本将继续更新发布服务器并对标识的 .MSIX 包进行重新签名。If any errors occur while processing an MSIX package, the script will continue to update the publisher and re-sign the identified MSIX packages. 不支持使用 SHA1 证书对 .MSIX 包格式应用程序进行签名。Signing the MSIX package format application with a SHA1 certificate is unsupported.

参数Parameters

-目录-directory

提供包含 .MSIX 应用程序的根目录。Provides the root directory which contains MSIX applications. 将以递归方式搜索所有 .MSIX 包的目录。This directory is recursively searched for all MSIX packages.

  • 键入: 类似Type: String
  • 必需: 是的Required: Yes
  • 位置: NamedPosition: Named
  • 默认值: 内容Default value: None

-certPath-certPath

提供证书文件(* .cer)的完整路径,该文件用于标识新的或更新的应用程序发布服务器信息。Provides the full path to the certificate file (*.cer) used to identify the new or updated app publisher information.

  • 键入: 类似Type: String
  • 必需: 是的Required: Yes
  • 位置: NamedPosition: Named
  • 默认值: 内容Default value: None

-已再发行-redist

.Msix 工具包中检索到的可再发行文件的路径。The path to the redistributable file retrieved from within the MSIX Toolkit. 此文件用于将应用重新打包为 .MSIX 包格式。This file is used to re-package the app into the MSIX package format. 必须指向32位或64位体系结构的可再发行组件。Must point to either the 32-bit or 64-bit architecture redistributable.

  • 键入: 类似Type: String
  • 必需: 是的Required: Yes
  • 位置: NamedPosition: Named
  • 默认值: 内容Default value: None

-pfxPath-pfxPath

代码签名证书(* .pfx)的路径,将在更新应用发布者后用于对 .MSIX 包进行签名。The path to the code signing certificate (*.pfx) which will be used to sign the MSIX package after updating the app publisher.

  • 键入: 类似Type: String
  • 必需:Required: No
  • 位置: NamedPosition: Named
  • 默认值: 内容Default value: None

-password-password

代码签名证书(* .pfx)所需的密码。The password required by the code signing certificate (*.pfx).

  • 键入: 类似Type: String
  • 必需:Required: No
  • 位置: NamedPosition: Named
  • 默认值: 内容Default value: None

-Forcecontinue 只能-forceContinue

如果已指定,则脚本将忽略错误并尝试更新所有应用程序的发布服务器信息。If specified, the script will ignore errors and attempt to update the publisher information of all apps.

  • 键入: 类似Type: String
  • 必需:Required: No
  • 位置: NamedPosition: Named
  • 默认值: 内容Default value: None