TeamCity LocalService PFX 程序集签名 - 证书安装位置

TeamCity LocalService PFX Assembly Signing - Where to Install the Certificate

我一直在四处寻找这个问题,虽然我发现了一些 "solutions",但似乎其中很多 "solutions" 是偶然发现的,或者无法充分解释真正有效的方法。

我已经尝试了很多解决方案,但我仍然遇到问题。

我在 Visual Studio 中创建了一个 .PFX。 TeamCity 和 Build Agent 都在我的本地开发机器上,所以我的情况没有涉及任何其他 PC。

当 TeamCity 尝试构建此项目时出现错误:

error MSB3325: Cannot import the following key file: name.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_6E76201C7E991E97

Team City Server 和 TeamCity Build Agent Local System Account 下的所有内容都 运行。

那么我在哪里安装证书呢?我已经打开 MMC.exe 并将其导入多个 "obvious places",例如 Local Computer 证书管理单元。我尝试将其导入 PersonalTrusted CA roots,但都没有用。

那么你到底把它放在哪里呢?

我的解决方案是创建一个新的用户帐户并在该用户帐户下导入 pfx 文件。然后在机器上配置 TeamCity 构建代理以在登录时使用该用户。有关更改构建代理使用的凭据的更多步骤,请参阅 this post

证书作为 MSCP 容器安装(因此它不是作为普通证书安装)。 标准方法是使用 sn.exe but you can also use SnInstallPfx.exe

有关详细信息,请参阅以下内容blog article