首页 > 解决方案 > 如果自签名清单,C# 无法在 Azure 管道中传递构建

问题描述

我有一个使用 .NET 框架在 Visual Studio 中构建的 WPF 项目。该应用程序将部署在多个位置,以便不同网络上的用户能够运行它并获取更新(发布 -> 应用程序更新 -> 在应用程序启动之前)。

我正在尝试建立一个管道来最终测试应用程序并将其发布到多个位置。为了增加安全性,我决定使用 (Signing -> Sign the ClickOnce manifests) 对清单进行自签名。

在此处输入图像描述

根据我所读到的内容(签署 ClickOnce 清单的目的是什么?),您应该签署清单以向您的用户添加应用程序/更新来自您的安全性。

我的问题是,当 Azure 尝试在管道中构建应用程序时,它会生成以下错误。

短的:

Error MSB3323: Unable to find manifest signing certificate in the certificate store

长:

##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3222,5): Error MSB3323: Unable to find manifest signing certificate in the certificate store.

谷歌搜索的解决方案似乎要求我删除此安全功能。(“无法在证书存储中找到清单签名证书”-即使添加新密钥

我是否误解了解决方案、自签名的原因,还是我应该寻找其他解决方案?(注意:我们不打算从第三方购买证书。)

有关应用程序的附加信息

安全 -> [Checked:true] 启用 ClickOnce 安全设置

安全性 -> 这是一个完全信任的应用程序

如果您需要有关项目/解决方案/构建/Azure 设置/...的其他信息,请告诉我。不确定与该问题相关的内容,我不想在这里转储整个项目。请询问,我会更新。

编辑:

YML 文件。

# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

标签: c#buildmanifestazure-pipelinesself-signed

解决方案


如果您以与本地相同的方式运行签名,则使用像您在本地执行的自托管代理是这里的解决方案。托管计算机不会在证书存储中安装您的证书。


推荐阅读