Simple scenario. Visual studio generates and signs things as part of the publish process.
I then go to the MyApp.dll.config.deploy
file and update some settings.
Now when I try to install the application the clickonce installer says the MyApp.dll.config
has a different computed hash than specified in manifest.
So I tried mage.exe -sign MyApplicationManifest -certfile ... -password ...
which results in MyApp.vsto successfully signed
But I still receive the computed hash error. Am I missing a step?
I've read the following links: http://msdn.microsoft.com/en-us/library/acz3y3te(v=vs.110).aspx http://blogs.msdn.com/b/msiclickonce/archive/2009/07/17/clickonce-application-fails-after-changing-configuration-file-and-resigning-the-manifest.aspx
There's a few steps that need to happen to resign the manifests. I used powershell to do it automatically.
.deploy
extension you'll need to rename them back to the original.mage.exe -update
on your application manifest. If you have a deployment manifest you'll need to do the same, except in the command line argument to mage.exe you need to specify the relative location to the application manifest.delcert.exe
and then sign it usingsigntool.exe
Note: Once an exe has been signed it cannot be resigned with signtool unless you remove the signing with delcert.exe.
If your clickonce is a VSTO clickonce your manifest names will be different (I think MyApp.dll.manifest vs MyApp.exe.manifest).
Update I've included the powershell script with sensitive information redacted.
You may be interested in the PowerShell script I have written, which as well as signing the manifest also fixes a new issue of ClickOnce not supporting SHA256 Certificates and SmartScreen no longer supporting SHA1, resulting in one or the other presenting a warning.
SignClickOnceApp.ps1
Code at time of posting
This article explains the very same case with more detail: https://blogs.msdn.microsoft.com/vsto/2009/04/29/signing-and-re-signing-manifests-in-clickonce-saurabh-bhatia/
The summarized solution is:
Update the application manifest
mage.exe –update Myapplication.exe.manifest –certfile mycert.pfx
Update .application file
mage.exe –update Myapplication.application –appmanifest “Application Files\MyApplication_%Version%\Myapplication.exe.manifest” –certfile mycert.pfx
Restore .deploy extensions if needed