VSTO Click-Once 证书破坏了 TFS 2015 构建

VSTO Click-Once Certificate breaks TFS 2015 build

我开发了一个 Excel 2010 插件。因此,我有一个带有相应证书的单击一次安装程序。在我的机器上一切正常,但现在我必须在 TFS 2015 上构建它。

每当签名打开时,我都会收到消息告诉我:

[error]C:\Program Files (x86)\MSBuild.0\bin\Microsoft.Common.CurrentVersion.targets(2718,5): Error MSB3326: Cannot import the following key file: . The key file may be password protected. To correct this, try to import the certificate again or import the certificate manually into the current user's personal certificate store.

C:\Program Files (x86)\MSBuild.0\bin\Microsoft.Common.CurrentVersion.targets(2718,5): error MSB3326: Cannot import the following key file: . The key file may be password protected. To correct this, try to import the certificate again or import the certificate manually into the current user's personal certificate store.

[error]C:\Program Files (x86)\MSBuild.0\bin\Microsoft.Common.CurrentVersion.targets(2718,5): Error MSB3321: Importing key file "My CERT.pfx" was canceled.

如果我将其关闭,则会收到另一条消息:

"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(159,9): Error : Cannot build because the ClickOnce manifest signing option is not selected. To select this option, open the project property pages, click the Signing tab, and then select "Sign the ClickOnce manifests.""

构建在这两种方式中都失败了,我不明白为什么。我什至删除了证书并从 cproj 文件中删除了有关签名的所有信息,但没有成功。

我想要一个没有签名的版本。我怎样才能达到这个目标?

在我重命名加载项项目并开始遇到完全相同的构建错误之前,我的 VSTO Outlook 加载项可以在线正常工作。

以下步骤对我有帮助:

  1. 取消选中“签署 ClickOnce 清单”和“签署程序集”选项。
  2. 从项目中删除所有 pfx 文件。
  3. 从 csproj 中删除所有与清单相关的标签。
  4. “创建测试证书”,无需在密码框中输入任何内容并选择 sha256RSA 算法。
  5. 从 .gitignore 中删除“*.pfx”文件(我使用 GIT 作为源代码控制)。
  6. 勾选“签署 ClickOnce 清单”选项。
  7. 将所有更改与新的“…_TemporaryKey.pfx”文件一起签入。

现在我只在 TFS 构建日志中收到以下警告,但至少构建不再失败:-)

“警告 MSB3327:无法在当前用户的 Windows 证书存储中找到代码签名证书。要更正此问题,请禁用 ClickOnce 清单的签名或将证书安装到证书存储中。”

希望这对你也有帮助!

重新创建新的 .pfx 文件成功了。请确保在提交代码时将新生成的 pfx 添加到您的存储库中。