Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClickOnce won't install .NET 4.5

I’m trying to deploy a WPF application using ClickOnce.
The project’s target framework is: “.NET Framework 4.5”.
In the VS project properties -> “Publish” -> “Prerequisites” I have checked two items:

  • “Microsoft .NET Framework 4.5 (x86 and x64)”
  • “Windows Installer 4.5”

When I try to launch this application on a Windows 7 computer that doesn’t have .NET 4.5 preinstalled I get a popup saying:

System Update Required Unable to install or run this application. This application requires Version 4.5 Full or other compatible .NET Framework. Please contact your system administrator.

The installation does not attempt to download/install the framework for me. It simply gives up displaying this message. The client user running the ClickOnce installation has administrator privileges on the machine.

Why doesn’t ClickOnce install .NET 4.5 automatically?

like image 608
SteffenSH Avatar asked Jan 10 '13 17:01

SteffenSH


People also ask

What is the difference between ClickOnce and Windows Installer?

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 I install prerequisites with ClickOnce application?

Click the Prerequisites button to open the Prerequisites dialog box. In the Prerequisites dialog box, make sure that the Create setup program to install prerequisite components check box is selected. In the Prerequisites list, check the components that you wish to install, and then click OK.

How do I clear my 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

I left out to mention in my question that I was upgrading from another ClickOnce application with prerequisites on .NET4.

ClickOnce prerequisites are only evaluated on the first installation so to upgrade to .NET4.5 I followed a technique described here. I.e. the old application uninstalls itself and then launches the installation of the new ClickOnce application with the new prerequisites on .NET4.5.

        Process.Start("iexplore.exe", newClickOnceApplicationUrl);
        Application.Current.Shutdown();

Some machines got the error message (“Please contact your system administrator.”) and some installed ok without any problems. On the machines that got the error it worked ok if the ClickOnce url was launched manually.

All users running the install were part of the Administrators group for their local machine. My theory is that the iexplorer.exe process launched from ClickOnce did not run under administrator privileges on the machines that had the problem. I did not investigate this any further though.

like image 193
SteffenSH Avatar answered Sep 25 '22 02:09

SteffenSH