Clickonce application fails after changing Configuration file and resigning the manifest

During the installation of clickonce applications at a customer site, we may have to modify one of our files let’s say an xml configuration file. But when we try to resign the application and deployment manifests we may get the following errors.

 There are numerous warnings similar to: “file.extension has mismatched identity ‘y’, expected file name: ‘file.extension.deploy’”

 there might be an error that states “appName.exe.deploy is not a valid entry point”

 

Below are the command lines tried:

mage -Sign 1_0_0_1\Program\appname.exe.manifest -CertFile mycertfile.pfx -Password myPwd

mage -Sign appname.application -CertFile mycertfile.pfx -Password myPwd

How to troubleshoot the above errors??

Use the latest version of mage.exe and mageUI.exe always.

Ideally, we got to update the changes (using mage –u), sign the app manifest(using mage –s), update the deployment manifest(mage –u) and lastly sign the deployment manifest. Following are the steps.

mage -u [application manifest path]

mage -s [application manifest] -certFile [path to certificate file]

mage -u [deployment manifest] -appmanifest [relative path to app manifest]

mage -s [deployment manifest] -certFile [path to certificate file]

Now, even after following the above steps if we still get those errors please read on.

So the troubleshooting goes as follows.

Re-Sign the app manifest using a certificate:

C:\Temp\PrivateInstall\1_0_0_1\Program>c:\Temp\mage.exe -s AppName.exe.manifest -cf c:\Temp\clickoncetest.pfx
AppName.exe.manifest successfully signed

Updated the deployment manifest so that the hash of the application manifest is current with the newly signed version:

C:\Temp\PrivateInstall>c:\Temp\mage.exe -u AppName.application -appm c:\Temp\PrivateInstall\1_0_0_1\Program\AppName.exe.manifest
AppName.application successfully updated and

 

Re-signed the deployment manifest with the same certificate that I used to sign the application manifest:

C:\Temp\PrivateInstall>c:\Temp\mage.exe -s AppName.application -cf c:\Temp\clickoncetest.pfx
AppName.application successfully signed

At this point the app would fail with the error

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Temp\PrivateInstall\AppName.application resulted in exception. Following failure messages were detected:
+ Downloading file:///C:/Temp/PrivateInstall/1.0.0.1/AppName.exe.manifest did not succeed.
+ Could not find a part of the path 'C:\Temp\PrivateInstall\1.0.0.1\AppName.exe.manifest'.
+ Could not find a part of the path 'C:\Temp\PrivateInstall\1.0.0.1\AppName.exe.manifest'.
+ Could not find a part of the path 'C:\Temp\PrivateInstall\1.0.0.1\AppName.exe.manifest'.

Now, we can use the windows file comparison tool (fc.exe) to compare the manifests before and after and we had to make the following changes.

So in PrivateInstall folder, made the following changes to the deployment manifest:
in AppName.application ~13:
change codebase="1.0.0.1\AppName.exe.manifest" -> codebase="1_0_0_1\Program\AppName.exe.manifest"

The problem that we are running into with this case can be addressed in two ways:

1) Adjust the application layout to match the form that mage.exe expects it to be in (if possible)

2) Author a script that does the same type of modification to the deployment manifest that we did (above) and use that script as a custom action in your package installer. The sequence of events that would have to be done in the MSI package is as follows:

     a) re-sign the application manifest.

     b) update the deployment manifest.

     c) modify the deployment manifest's codebase attribute to match the original intent of

         the ISV.

     d) re-sign the deployment manifest.

 

Please notice that the above troubleshooting was done by one of our ClickOnce product team engineer for me to help one of my customers. The above may or may not be applicable in your situation if not I would encourage you to post a question to this blog so that I can look into.

 


CONTENT : Aditya Hari


REVIEW : Ravi Shankar