在发布时配置 ClickOnce 包
Configuring ClickOnce Package on Release
我正在处理从旧的手动实施的 ci/cd 解决方案到 Azure DevOps 的管道迁移。
有一些预建的 functions/processes 我仍在重复使用。
例如。比如他们如何将所有解决方案打包为工件。
我尽量减少代码更改。
构建管道创建了一个 ClickOnce 包 .zip
。
然后在发布阶段,应用程序文件中的myapp.exe.config
通过XML-Document-Transform进行转换。应用程序清单 <ApplicationName>.application
也通过 Powershell 手动编辑。 <deploymentProvider codebase="http://1.1.1.1/samplefolder/myapp.application" />
在发布时根据将要部署到的 environment/path 进行更改。
申请清单
<asmv1:assembly ...>
<deployment ...>
<subscription>
<update>
<beforeApplicationStartup />
</update>
</subscription>
<deploymentProvider codebase="http://1.1.1.1/samplefolder/myapp.application" />
</deployment>
</asmv1:assembly>
现在我明白了这个方法需要对整个包重新签名。他们有一个自定义 .exe
文件来重新签署整个包(不是 mage.exe)。不幸的是,我不能重复使用上述可执行文件来重新签名。
我只有他们的证书指纹。但是我不知道怎么办。
问题:
- 重新签署包裹的其他选择是什么?
- 有更好的方法吗?我是否必须为此解决方案进行另一个构建步骤?
我已经使用 dotnet mage 在发布时对 ClickOnce Appmanifest (*.application
) 和 *.exe.manifest
文件进行了签名。我通过在安全文件中添加证书(.pfx
或 .p12
)文件并在管道变量中添加证书密码来完成此操作。
- 使用 .NET Core 任务指定使用版本 5.x。
- 可选步骤 通过
dotnet tool update --global microsoft.dotnet.mage --version 5.0.0
重新安装
- 运行 powershell中的以下内容
## Signing the exe.manifest file
dotnet mage -update "<folder>/Application Files/<assembly folder name>/<assemblyname>.exe.manifest" -fd "<folder>/Application Files/<folder>" -CertFile "$(SignKey.secureFilePath)" -Password "$(SignKeyPassword)"
## Signing the .Application file
dotnet mage -update "<the .Application full path>" -pu "$publisherURL" -pub "$(PublisherDetails)" -appmanifest "Application Files/<assembly folder name>/<assemblyname>.exe.manifest" -CertFile "$(SignKey.secureFilePath)" -Password "$(SignKeyPassword)"
我正在处理从旧的手动实施的 ci/cd 解决方案到 Azure DevOps 的管道迁移。 有一些预建的 functions/processes 我仍在重复使用。
例如。比如他们如何将所有解决方案打包为工件。
我尽量减少代码更改。
构建管道创建了一个 ClickOnce 包 .zip
。
然后在发布阶段,应用程序文件中的myapp.exe.config
通过XML-Document-Transform进行转换。应用程序清单 <ApplicationName>.application
也通过 Powershell 手动编辑。 <deploymentProvider codebase="http://1.1.1.1/samplefolder/myapp.application" />
在发布时根据将要部署到的 environment/path 进行更改。
申请清单
<asmv1:assembly ...>
<deployment ...>
<subscription>
<update>
<beforeApplicationStartup />
</update>
</subscription>
<deploymentProvider codebase="http://1.1.1.1/samplefolder/myapp.application" />
</deployment>
</asmv1:assembly>
现在我明白了这个方法需要对整个包重新签名。他们有一个自定义 .exe
文件来重新签署整个包(不是 mage.exe)。不幸的是,我不能重复使用上述可执行文件来重新签名。
我只有他们的证书指纹。但是我不知道怎么办。
问题:
- 重新签署包裹的其他选择是什么?
- 有更好的方法吗?我是否必须为此解决方案进行另一个构建步骤?
我已经使用 dotnet mage 在发布时对 ClickOnce Appmanifest (*.application
) 和 *.exe.manifest
文件进行了签名。我通过在安全文件中添加证书(.pfx
或 .p12
)文件并在管道变量中添加证书密码来完成此操作。
- 使用 .NET Core 任务指定使用版本 5.x。
- 可选步骤 通过
dotnet tool update --global microsoft.dotnet.mage --version 5.0.0
重新安装
- 运行 powershell中的以下内容
## Signing the exe.manifest file
dotnet mage -update "<folder>/Application Files/<assembly folder name>/<assemblyname>.exe.manifest" -fd "<folder>/Application Files/<folder>" -CertFile "$(SignKey.secureFilePath)" -Password "$(SignKeyPassword)"
## Signing the .Application file
dotnet mage -update "<the .Application full path>" -pu "$publisherURL" -pub "$(PublisherDetails)" -appmanifest "Application Files/<assembly folder name>/<assemblyname>.exe.manifest" -CertFile "$(SignKey.secureFilePath)" -Password "$(SignKeyPassword)"