Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClickOnce Upgrade Fails after Converting to .NET 4

Tags:

.net

clickonce

Our application is .NET 3.5 deployed via ClickOnce. We just upgrade to .NET 4.0 and updated the pre-requisities appropriately.

The install still works fine for first-time users or users who install via the setup HTML page. It will automatically install the .NET 4 framework for them. However, users who already have the application installed and attempt to run it via the start menu get the prompt:

"Unable to install or run this application. This application requires your system to be updated to the Microsoft Common Language Runtime Version 4.0.30319.0. More information can be found here" (link to MS website)

Why doesn't it automatically install .NET 4.0 as it does when you run it from the html page? It does not even give the option to download updates. We need a seamless solution for our customers to upgrade to the new application without re-installing manually.

like image 261
Greg Ennis Avatar asked Sep 20 '10 20:09

Greg Ennis


People also ask

How do I update my ClickOnce app?

To check for updates before the application startsClick the Publish tab. Click the Updates button to open the Application Updates dialog box.

Is ClickOnce still supported?

ClickOnce and DirectInvoke are supported out of the box for all Windows users. Users that want to disable ClickOnce support can go to edge://flags/#edge-click-once and select Disabled from the dropdown list. You'll have to Restart the browser.

Does ClickOnce require admin rights?

Windows Installer deployment requires administrative permissions and allows only limited user installation; ClickOnce deployment enables non-administrative users to install and grants only those Code Access Security permissions necessary for the application.

How do you delete ClickOnce cache?

To delete the ClickOnce file cache, delete the contents of this folder based on the operating system. Deleting these files will clear the information for all installed ClickOnce applications. They'll reinstall the next time their shortcut or Uniform Resource Identifiers (URIs) are used.


1 Answers

Read this question and answer first.

Here's what's happening in your scenarios.

  1. "The install works fine for first-time users..."
    Actually, this would work for any user that went to the html page, not just first-time users. The html page has some script that checks their user-agent string for the 4.0 framework. If they don't have it, it gives them an explanation and tells them to install it from a link to the bootstrapper that Visual Studio created (setup.exe). This is all separate from ClickOnce; ClickOnce does nothing until they click on the link to the .application file or they run the setup.exe which launches the .application file when it finishes.

  2. "Users who already have the application installed and attempt to run it via the start menu..."
    What happens here, is that the application updates correctly. They get the latest version. Only they can't run the latest version because it's a .Net 4.0 executable and they don't have the 4.0 framework.

At this point you have a few options...

  • Live with it. Tell users they need to visit the html page to get the 4.0 Framework.
  • Roll-back to 3.5 and add custom code to your app that checks whether 4.0 is installed or not, warns the user, and gives them a link to the new 4.0 setup.exe file. Then upgrade to 4.0 a few weeks later once people have had the chance to install it. This may not work well if your users only run the app occasionally.
  • Roll-back to 3.5 and change your ClickOnce updates to happen after the application starts rather than before. This will give you the chance to write custom code to determine if the update can happen or not and tell the user.
like image 139
codeConcussion Avatar answered Sep 20 '22 05:09

codeConcussion