Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use mage.exe to resign manifests for VSTO?

Tags:

c#

clickonce

mage

We have an Excel plugin as part of our Visual Studio solution. The plugin is built once and then deployed out to different environments (dev, uat, prod) as part of our CI/CD process.

During the deploys we apply an app config transform to update the Excel plugin config with the correct environmental config.

As such, the manifest and VSTO needs resigning. I've been through a number of SO posts (Use mage.exe to create a ClickOnce deployment manifest for *.deploy files, Resign manifest of click-once application change from 4.0 to 4.5, Resign Clickonce manifest using mage.exe etc.) and MSDN posts and cannot work out the correct way to call mage.exe for this to work.

I've tried mage.exe -update ..., mage.exe -sign ... and a couple of other combinations that all result in broker or invalid manifests when I try to launch the VSTO e.g.

C:\Tools\mage.exe -update "$CodeBasePath\MyCompany.vsto" -certFile "$CertFile" -password "$CertPassword" -appManifest "$AppManifestPath"

Does anything know the correct order of signing and flags to use with mage.exe when re-signing a VSTO?

like image 536
user783836 Avatar asked May 10 '16 14:05

user783836


People also ask

How do I use Mage exe?

This tool is automatically installed with Visual Studio. To run the tool, use Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell. Two versions of Mage.exe and MageUI.exe are included with Visual Studio. To see version information, run MageUI.exe, select Help, and select About.

What is VSTO deployment manifest?

A deployment manifest is an XML file that describes the deployment settings of an Office solution and identifies the current application version. The Office development in Visual Studio uses the ClickOnce deployment manifest schema defined in the ClickOnce deployment manifest reference.


1 Answers

before updating the VSTO file you need to first update the application manifest.

mage -update yourFile.dll.manifest -CertFile certificate.pfx -Password password

Then you need to update the VSTO with the application manifest you already updated.

mage -update yourFile.vsto -appmanifest yourFile.dll.manifest -CertFile certificate.pfx -Password password

like image 91
Portalus Avatar answered Oct 23 '22 03:10

Portalus