After you make changes to deployment properties in the application manifest for Windows Forms applications, Windows Presentation Foundation applications (xbap), or Office solutions, you must re-sign both the application and deployment manifests with a certificate. This process helps ensure that tampered files are not installed on end user computers.
Another scenario where you might re-sign the manifests is when your customers want to sign the application and deployment manifests with their own certificate.
Re-sign the Application and Deployment Manifests
This procedure assumes that you have already made changes to your application manifest file (.manifest). For more information, see How to: Change deployment properties.
Note
In ClickOnce for .NET Core 3.1 and .NET 5 or later, use dotnet-mage.exe instead of Mage.exe. For more information, see ClickOnce for .NET.
To re-sign the application and deployment manifests with Mage.exe
Open a Visual Studio Command Prompt window.
Change directories to the folder that contains the manifest files that you want to sign.
Type the following command to sign the application manifest file. Replace ManifestFileName with the name of your manifest file plus the extension. Replace Certificate with the relative or fully qualified path of the certificate file and replace Password with the password for the certificate.
For example, you could run the following command to sign an application manifest for an add-in, a Windows Form application, or a Windows Presentation Foundation browser application. Temporary certificates created by Visual Studio are not recommended for deployment into production environments.
For example, you could run the following command to update and sign a deployment manifest for an Excel add-in, a Windows Forms application, or a Windows Presentation Foundation browser application.
Optionally, copy the master deployment manifest (publish\<appname>.application) to your version deployment directory (publish\Application Files\<appname>_<version>).
Update and re-sign the application and deployment manifests
This procedure assumes that you have already made changes to your application manifest file (.manifest), but that there are other files that were updated. When files are updated, the hash that represents the file must also be updated.
To update and re-sign the application and deployment manifests with Mage.exe
Open a Visual Studio Command Prompt window.
Change directories to the folder that contains the manifest files that you want to sign.
Remove the .deploy file extension from the files in the publish output folder.
Type the following command to update the application manifest with the new hashes for the updated files and sign the application manifest file. Replace ManifestFileName with the name of your manifest file plus the extension. Replace Certificate with the relative or fully qualified path of the certificate file and replace Password with the password for the certificate.
For example, you could run the following command to sign an application manifest for an add-in, a Windows Form application, or a Windows Presentation Foundation browser application. Temporary certificates created by Visual Studio are not recommended for deployment into production environments.
For example, you could run the following command to update and sign a deployment manifest for an Excel add-in, a Windows Forms application, or a Windows Presentation Foundation browser application.
Add the .deploy file extension back to the files, except the application and deployment manifest files.
Optionally, copy the master deployment manifest (publish\<appname>.application) to your version deployment directory (publish\Application Files\<appname>_<version>).
In this module, you'll master deploying applications using Intune, Configuration Manager, Group Policy, and Microsoft Store Apps. These powerful tools and techniques will equip you to manage and maintain diverse applications across your organization effectively.
Get started with Mage.exe, the Manifest Generation and Editing Tool. This tool supports the creation and editing of application and deployment manifests.
Learn how to create ClickOnce applications to be deployed by customers without generating a new deployment manifest and that can use the customer branding.
Learn how to create a ClickOnce deployment by using either the command-line version or the graphical version of the Manifest Generation and Editing Tool.