不安裝證書可以使用 MSBuild 的 SignFile 嗎? (Can MSBuild's SignFile be used without installing the certificate?)


問題描述

不安裝證書可以使用 MSBuild 的 SignFile 嗎? (Can MSBuild's SignFile be used without installing the certificate?)

我有一個 ClickOnce 應用程序,我已對其進行了更新,以便使用帶有 MSBuild 的現代部署 Jenkins Pipeline 進行部署。這項工作的一部分是對 .manifest 和 .application 文件進行簽名。

之前我們使用 和 MSBuild 來簽署這些文件,使用安裝在用戶個人文件中的證書存儲在構建機器上。它適用於:

<SignFile SigningTarget="MyApp.exe.manifest" 
          CertificateThumbprint="1a 9f ..." 
          TimestampUrl="http://timestamp.verisign.com/scripts/timstamp.dll" />
<SignFile SigningTarget="MyApp.application" 
          CertificateThumbprint="1a 9f ..." 
          TimestampUrl="http://timestamp.verisign.com/scripts/timstamp.dll" />

但是,在 21 世紀,我們更喜歡在版本控制中或通過 API 在秘密存儲中提供構建所需的一切,這樣我們就不再依賴構建服務器處於某種狀態。

那麼我們如何在不需要安裝證書的情況下使用 SignFile 對 ClickOnce 清單和應用程序進行簽名?


參考解法

方法 1:

It seems like the old mage.exe is more full‑featured than SignTool.

So I copied mage.exe to my project dependencies folder from C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools, then in MSBuild, this worked for me:

<Message Text="Signing APP manifest (.exe.manifest)" />
<Exec Command="Dependencies\mage.exe ‑sign $(MyAppManifest).exe.manifest ‑CertFile MyLocalKey.pfx ‑Password MyPassword123" />

Then I did something very similar to that for the deployment manifest (.application) file.

Apparently the newer versions of mage.exe can indeed support SHA‑256, contrary to some web pages I found on the topic (perhaps they were older).

(by Patrick SzalapskiPatrick Szalapski)

參考文件

  1. Can MSBuild's SignFile be used without installing the certificate? (CC BY‑SA 2.5/3.0/4.0)

#clickonce #assembly-signing #certificate #msbuild






相關問題

ClickOnce 發布 (ClickOnce publishing)

如何在無需重新下載每個文件的情況下更新已部署的 clickonce 應用程序? (How do I update a deployed clickonce application without having to redownload every file?)

Bạn cần thực hiện các bước nào để tạo lại tệp kê khai khi sử dụng triển khai Nhấp Một lần (What steps do you need to take to regenerate the manifest when using Click Once deployment)

將 VS 2013 中的 WPF 應用程序發佈到 Programm Files 中——不可能嗎? (Publishing a WPF app in VS 2013 in to Programm Files -- impossible?)

ClickOnce部署,需要係統更新Microsoft.mshtml (ClickOnce Deployment, system update required Microsoft.mshtml)

ClickOnce 從緩存中安裝舊程序集 (ClickOnce installing old assemblies from cache)

使用 MSBuild 發布 ClickOnce 應用 (Publish ClickOnce app with MSBuild)

單擊一個發布 (Click one Release)

使用 PostSharp 1.0 的 ClickOnce 應用程序似乎需要 GAC 中的 1.5 程序集 (ClickOnce application that uses PostSharp 1.0 seems to require 1.5 assemblies in GAC)

如何在遠程計算機上運行 ClickOnce 應用程序 (.appref-ms)? (How to run a ClickOnce application (.appref-ms) on a remote computer?)

使用證書籤署 ClickOnce? (Signing ClickOnce with a certificate?)

不安裝證書可以使用 MSBuild 的 SignFile 嗎? (Can MSBuild's SignFile be used without installing the certificate?)







留言討論