TFS 持续集成 clickonce 应用

TFS Continuous integraton clickonce application

我正在尝试通过 TFS 持续集成自动部署 clickonce 应用程序,我的构建定义具有以下步骤(已简化,出于演示字符串的原因)

获取来源:来自 TFS 服务器

Nuget 恢复:恢复 nuget 包

PowerShell 脚本:用于将证书添加到解决方案的主项目,如下所示:

$password = 'password'
Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import("$(CertPath)", $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")
$store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite")
$store.Add($cert)
$store.Close()

MSBuild:生成解决方案文件

所有运行正常,但是当我尝试打开代理 Bin/release 路径上的 exe 文件时,我遇到了这个异常:

请帮帮我。

我删除了代理并进行了新的编译,一切正常。谢谢