Mage
Mage is a command-line tool in Microsoft ClickOnce deployment used to create, manage, and sign ClickOnce deployment manifests, enable simplified distribution, and update Windows-based applications.
Note
Mage is automatically installed with Visual Studio.
Mage can be run from:
Batch scripts
Other Windows-based applications (including ASP.NET applications)
Integrate mage.exe with Signing Manager Controller (SMCTL) for simplified signing. Alternatively, you can sign directly with Mage and reference your private key stored in Software Trust Manager.
Astuce
Mage is only compatible for signing on Windows.
What can Mage be used to sign?
Use Mage to sign the following file types:
.application
.manifest
.vsto
Astuce
When you sign a manifest file using mage, two signature units are consumed. This is because two hash signatures are created for different types of content within the manifest:
The first hash signature is generated for the manifest file itself.
The second hash signature is generated for the files referenced within the manifest.
This double-signing process ensures the integrity of both the manifest file and its referenced files, safeguarding against any tampering attempts.
Download Mage
Mage is included in the Windows Software Development Kit (SDK). The Windows SDK additionally contains SignTool and NuGet which may be used to sign other file types.
To install the Windows SDK:
Download the Windows SDK.
Run the winsdksetup.exe file that was downloaded.
Follow the instructions in the wizard to complete the installation.
Astuce
Mage will be located in the file path:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools
Set PATH environment variable
Operating systems use the environment variable called PATH to determine where executable files are stored on your system. Use the PATH environment variable to store the file path to your signing tools to ensure that the CLI can reference these signing tools.
You can set the PATH environment variable to mage.exe using command line or environment variables.
To set the path to your signing tools via command line:
set PATH=%path%;<path to signing tool folder>
Command sample:
set PATH=%path%;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\
To set the path to your signing tools for your system or account:
Search for environment variables in the Windows start menu.
Select Edit environment variables for your account or Edit system environment variables.
Double click on the Path variable.
Click New.
Select Browse.
Select the path to the signing tool.
Example: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\mage.exe
Click OK to save the path.
Click on OK to close the dialog.
Download and register KSP library
Mage integrates with Software Trust Manager KSP library to sign.
Follow these instructions to download and register Software Trust Manager KSP library.
Sign with Mage
You can sign with Mage directly or via DigiCert signing tools integrated with Mage: