views:

104

answers:

2

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.

+2  A: 

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.
whatknott
Thanks for the explanation.
grennis
A: 

Another choice is to roll back to the .NET 3.5 version and add custom code that programmatically unisntalls the application and reinstalls it from a different URL that has .NET 4 as the prerequisite. People who already have .NET 4 will just get a new install of the ClickOnce bit; people with . NET 3.5 will get their app uninstalled, .NET 4 installed, and the new version of their app installed.

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

RobinDotNet

related questions