azure-devops - 在发布时配置 ClickOnce 包
问题描述
我正在处理从旧的手动实施的 ci/cd 解决方案到 Azure DevOps 的管道迁移。我仍在重用一些预构建的功能/流程。
例如。就像他们如何将所有解决方案打包为工件一样。
我试图尽可能减少代码更改。
构建管道创建一个 ClickOnce 包.zip
。
然后在发布阶段,myapp.exe.config
应用程序文件中的文件通过 XML-Document-Transform 进行转换。应用程序清单也<ApplicationName>.application
通过 Powershell 手动编辑。根据<deploymentProvider codebase="http://1.1.1.1/samplefolder/myapp.application" />
将要部署到的环境/路径,发布时会更改。
应用清单
<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)"
推荐阅读
- aws-iam - AWS 访问密钥,无需访问控制台
- avaudiosession - AudioKit:当应用程序在后台时始终出现红色麦克风图标
- javascript - 在javascript中计算时间
- html - 链接跨越整个页面(使用图像作为链接)
- jquery - 使用 Ajax 从外部网页显示 CSS 和 HTML
- swift - 我的相机应用程序的 Swift 代码中有几个错误
- escaping - 防止 Excel 在 JXL API 创建的文件中使 URL 可点击
- java - 如何使用 Springboot 和 Thymeleaf 使用 LocalTime 在两个日期之间进行验证
- typescript - 从没有属性或属性列表的接口创建类型
- sql - 用户同时更新同一行 SQL Server