问题
How does one use mage.exe to create a ClickOnce deployment manifest, when the application files have the *.deploy extension? Some give up and use MSBuild.exe and the GenerateDeploymentManifest task instead. What if you want to use mage.exe directly?
回答1:
If you want to use mage.exe alone, what you need to know is that it cannot be done. At least not with mage.exe alone.
Mage.exe does not have a way to build a deployment manifest (*.application file) to download *.deploy files. You must manually edit the deployment manifest (*.application file) before signing it. Specifically, you need to add the mapFileExtensions attribute to the deployment XML element.
As an example suppose you have an executable named ClickOnceText.exe in a folder named 1.0.0.0., here is what you do:
> mage -n Application -t 1.0.0.0\ClickOnceTest.exe.manifest -fd 1.0.0.0 -cf ..\code.p12 -pwd passwd
ClickOnceTest.exe.manifest successfully signed
> mv 1.0.0.0\ClickOnceTest.exe 1.0.0.0\ClickOnceTest.exe.deploy
> mage -n Deployment -t ClickOnceTest.application -appm 1.0.0.0\ClickOnceTest.exe.manifest
ClickOnceTest.application successfully created
> notepad ClickOnceTest.application
And here is the trick. Add the mapFileExtensions to the deployment element:
<deployment mapFileExtensions="true" ... >
And then sign the deployment manifest (*.application).
> mage -u ClickOnceTest.application -cf code.p12 -pwd passwd
ClickOnceTest.application successfully signed
回答2:
Like Wally says, you can't make a deployment manifest for *.deploy files.
However, you can remove the .deploy extensions and THEN use Mage.exe. You can remove the .deploy extension manually, or you can also do so in the Publish subsection under Properties for your project in Visual Studio (I'm using 2017, but it should be the case for earlier editions as well.)
Under Publish, select Options. Inside of Publish Options, select Deployment. There is a checkbox where you can toggle "Use '.deploy' file extension". By unchecking this box, the building/publishing of your app will generate all of its usual files but skip the .deploy extension.
From here, you can use Mage.exe directly.
来源:https://stackoverflow.com/questions/25777441/use-mage-exe-to-create-a-clickonce-deployment-manifest-for-deploy-files