Up until now our app has been published using ClickOnce via the Visual Studio "Publish" wizard. This has been rather painful, and we've automated the process using msbuild/mage.
Unfortunately, the new deployment does not appear to be compatible with the old one, giving the "The deployment identity does not match the subscription" error when the (test) users update.
Now there are plenty of differences between the files generated using "Publish" and our Mage script, but we can't eliminate them all. For example, "Publisher" doesn't seem to be respected by GenerateDeploymentManifest
, while Mage -New Deployment
can't set UpdateMode to Foreground. There are other similar cases.
Has anyone ever successfully moved away from the "Publish" wizard without requiring the entire user base to reinstall the app? What was your approach?
P.S. VisualStudio 2008; all users are on .NET Framework 3.5 SP1.
Best Answer
The trick was to match the so-called assembly identity.
Hint #1: do not use Mage to generate the deployment manifest (the *.application file). Use
GenerateDeploymentManifest
instead. The Mage tool lacks two crucial options:Hint #2: DO use Mage to add publisher and sign the deployment certificate. This is because
GenerateDeploymentManifest
seems to ignore Publisher (in 3.5 SP1 at least), and similarlySignFile
is unable to use a .pfx file as the key. Whoops.Hint #3: to supply the correct relative path for the "codebase" field in the deployment XML, use the following snippet:
and then pass
EntryPoint="@(EntryPoint)"
toGenerateDeploymentManifest
. The key bit is the "TargetPath" metadata. Yuck!Hint #4: patience, a supply of old working manifests, and a good comfy diff tool.
Is this complicated and painful? Yes! But is it better than the Publish wizard? OH YES!
Edit: I've posted a working example of how one might invoke Mage from MSBuild - however working doesn't mean you can just plug it in, since there are lots of settings involved that you may want to change, and you still need to understand ClickOnce to some extent. But hopefully it can provide a useful starting point.