Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move a ClickOnce deployment package

I have a collection of ClickOnce packages in a publish folder on a network drive and need to move them all to another server (our DR machine).

After copy/pasting the whole directory and running the setups on the new machine I get an error message stating that it cannot find the old path:

Activation of ...MyClickOnceApp.application resulted in exception. Following failure messages were detected:

+ Downloading file://oldMachine/c$/MyClickOnceApp.application did not succeed.

+ Could not find a part of the path '\\oldMachine\c$\MyClickOnceApp.application'.

Once I change the installation URL to point at my new machine, I get another error:

Manifest XML signature is not valid.

+ The digital signature of the object did not verify.

I've tried using MageUI.exe, to modify the deployment URL, but it asks for a certificate, which I don't have.

What am I doing wrong and how do I successfully move published ClickOnce packages?

like image 925
HAdes Avatar asked Oct 06 '08 15:10

HAdes


4 Answers

I found a solution:

Firstly, using MageUI, I changed the "Start Location" under "Deployment Options". On saving, it prompted me to sign with a key, which I created there and then. I then ran the setup.exe file, and it worked without fail.

After checking which files had changed, I realised it was only the one file: the application manifest file (myAppName.application). The only things that changed in the file were the deployment provider and the signature (which is what I changed in MageUI).

Once I realised this was how to do it, I used the command line version of MageUI called Mage.exe, which comes with the SDK.

Below is the batch file I created to do all of this on the command line:

REM Set the enviroment
call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"

REM Update the deployment provider URL
mage -Update %1.application -pu %2

REM Sign the manifest with our key
mage -Sign %1.application -CertFile C:\AppKey.pfx -Password myPw

I can now use this to run against all of my published applications in a quick and easy way. I hope this helps.

like image 135
HAdes Avatar answered Sep 26 '22 02:09

HAdes


Without getting into too much detail, this should get you going.

ClickOnce manifests must be signed with a certificate for security reasons. You can purchase a code signing certificate or generate a test one. The main drawback of a test certificate is that your application publisher will appear as "Unknown" rather than your company's name.

In Visual Studio, open your project's properties and go to the "Signing" tab, select "Sign the ClickOnce manifests", and "Create Test Certificate". Next, click "More Details" to bring up a dialog and click "Install Certificate". This will run you through a wizard to get your test cert in your store. Make sure you put it in the "Personal" store.

Now you can use MageUI to edit your manifests. Any time you save it will prompt you to sign the manifests but you should now be able to select the test cert you just stored. Always edit/sign the application manifest before editing/signing the deployment manifest. This is confusing because the application manifest isn't the file with the .application extension.

Good luck!

like image 22
codeConcussion Avatar answered Sep 23 '22 02:09

codeConcussion


I would expect to have to do the following:

  • Copy current folder contents to new location
  • For each app:-
    • Change 'Installation folder' to the new location
    • Publish as a new version
    • Change 'Publishing folder' to the new location
    • Publish as a new version

New setups run from the new folder should work and existing ones should update to look in the correct place.

All this is untested, but I'm pretty sure that's what I did previously...

Edit:

Obviously, you'll have to run these in parallel for a certain amount of time, but as it's an internal app the worst that will happen when you finally switch over to the new location is that you'll have to inform the user of the new location to obtain a 'fixed' app

like image 35
Carl Avatar answered Sep 23 '22 02:09

Carl


I believe that you do have a certificate. You need one to create a ClickOnce deployment. Visual Studio may have autocreated a self-signed one for you. I'm not too familiar with the process, hopefully someone with a more definitive answer will chip in. Also, have you tried the MageUI tool, maybe it will be more obvious what you need to do using a GUI.

like image 23
Darrel Miller Avatar answered Sep 25 '22 02:09

Darrel Miller