ClickOnce Upgrade Error After Converting to .NET 4

Our .NET 3.5 application is deployed through ClickOnce. We simply upgrade to .NET 4.0 and update the prerequisites accordingly.

Installation still works great for users or users who are installing the settings page for the first time. He will automatically install the .NET 4 platform for them. However, users who already have the application installed and try to launch it through the Start menu receive an invitation:

"It is not possible to install or run this application. This application requires that your system be updated to the Common Language Runtime version 4.0.30319.0. For more details, see here" (link to the MS website)

Why doesn’t it automatically install .NET 4.0, how does it happen when you start it from an html page? It does not even provide the ability to download updates. We need a seamless solution for our customers to upgrade to a new application without having to reinstall it manually.

+6
clickonce
source share
2 answers

Read this question and answer first .

This is what happens in your scripts.

  • "Installation works great for first-time users ..."
    In fact, this will work for any user who has gone to the html page, and not just for new users. There is a script on the html page that checks its user agent string for the 4.0 framework. If they do not have it, he gives them an explanation and tells them to install it using the link to the bootloader created by Visual Studio (setup.exe). It is all separate from ClickOnce; ClickOnce does nothing until it clicks on the link to the .application file or runs the setup.exe file, which launches the .application file at the end.

  • "Users who already have the application installed and try to launch it through the Start menu ..."
    What is happening here is that the application is updating correctly. They get the latest version. Only they cannot run the latest version because it is an executable .Net 4.0 file and they do not have a 4.0 framework.

At this point you have several options ...

  • Live with him. Tell users that they need to visit the html page to get the 4.0 Framework.
  • Rollback to 3.5 and adding special code to the application, which checks whether 4.0 is installed or not, warns the user and gives a link to the new setup.exe 4.0 file. Then upgrade to version 4.0 in a few weeks, as soon as people have the opportunity to install it. This may not work if your users only start the application sometimes.
  • Rollback to 3.5 and changes to ClickOnce updates will occur after the application is launched, and not earlier. This will give you the opportunity to write your own code to determine whether the update can occur or not, and inform the user.
+5
source share

Another option is to revert to .NET 3.5 and add special code that programmatically unisntalls the application and reinstalls it from another URL that has .NET 4 as a prerequisite. People who already have .NET 4 just get the new ClickOnce bit set; people with .NET 3.5 will install their application installed by .NET 4, and a new version of their application is installed.

You can find / reinstall the code in this MSDN article here .

+2
source share

All Articles