How can I cancel clickOnce if I have the minimum required version?

We decided to use minimumRequiredVersion in our manifest of the clickOnce application, and now, when we try to roll back to the previous version, when the user starts the application, it does not start. He says that the application manifest has an earlier version than the required version, and the user cannot use the application. We did not have this problem with a minimal RequiredVersion, but we would like to use this.

+4
clickonce
Oct 27 '08 at 22:06
source share
4 answers

You need to deploy the new version with a higher version number. There is no built-in rollback function.

+7
Oct 27 '08 at 22:11
source share

You can use Mage.exe to upgrade the deployment manifest (extension of the extension file) to a higher version and select the manifest of the application of the previous version. As chilltemp said, you still need to upgrade to a higher version, but you don't need to redeploy your code.

+2
Nov 07 '08 at 21:37
source share

If you want to cancel the version from the previous one to the minimum required version of the client, you will need to reinstall the clickonce application.

Take a look at this link to see how this can be done in code: ClickOnce and Exping Code Signing Clicks

0
Jul 27 '09 at 9:00
source share

This can be done using reflection if you know the publisher uri and name, version public key token, and processor architecture for both deployment and application.

The code below will try to cancel the "coolapp.app" click once. If he cannot rollback, he will try to remove it.

using System; using System.Deployment.Application; using System.Reflection; namespace ClickOnceAppRollback { static class Program { /// /// The main entry point for the application. /// static void Main() { string appId = string.Format("{0}#{1}, Version={2}, Culture={3}, PublicKeyToken={4}, processorArchitecture={5}/{6}, Version={7}, Culture={8}, PublicKeyToken={9}, processorArchitecture={10}, type={11}", /*The URI location of the app*/@"http://www.microsoft.com/coolapp.exe.application", /*The application assemblyIdentity name*/"coolapp.app", /*The application assemblyIdentity version*/"10.8.62.17109", /*The application assemblyIdentity language*/"neutral", /*The application assemblyIdentity public Key Token*/"0000000000000000", /*The application assemblyIdentity processor architecture*/"msil", /*The deployment dependentAssembly name*/"coolapp.exe", /*The deployment dependentAssembly version*/"10.8.62.17109", /*The deployment dependentAssembly language*/"neutral", /*The deployment dependentAssembly public Key Token*/"0000000000000000", /*The deployment dependentAssembly processor architecture*/"msil", /*The deployment dependentAssembly type*/"win32"); var ctor = typeof(ApplicationDeployment).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(string) }, null); var appDeployment = ctor.Invoke(new object[] { appId }); var subState = appDeployment.GetType().GetField("_subState", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(appDeployment); var subStore = appDeployment.GetType().GetField("_subStore", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(appDeployment); try { subStore.GetType().GetMethod("RollbackSubscription").Invoke(subStore, new object[] { subState }); } catch { subStore.GetType().GetMethod("UninstallSubscription").Invoke(subStore, new object[] { subState }); } } } } 
0
Jul 01 2018-12-12T00:
source share



All Articles