Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
286 views
in Technique[技术] by (71.8m points)

c# - 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 '\oldMachinec$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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 FilesMicrosoft Visual Studio 9.0VCvcvarsall.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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...