Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClickOnce cannot find its prerequisites while the files are at the place they have to be

I want to publish my application using ClickOnce with some prerequisites (.NET 4.5 and SQL Server Express).

I did as it says in How to: Include Prerequisites with a ClickOnce Application (note that the package folders were at v8.1A folder instead of v8A folder), but it still says it can't find the files. I've tried both Visual Studio 2013 and Visual Studio 2015 RC.

To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'DotNetFX45\dotNetFx45_Full_x86_x64.exe' for item 'Microsoft .NET Framework 4.5 (x86 and x64)' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=239883.

To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'SqlExpress2012\SQLEXPR32_x86_ENU.EXE' for item 'SQL Server 2012 Express' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=239883.

To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'SqlExpress2012\SQLEXPR_x64_ENU.EXE' for item 'SQL Server 2012 Express' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=239883.

To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'DotNetFX40ClientKB2468871\dotNetFx40_Client_x86_x64.exe' for item 'Microsoft .NET Framework 4 Client Profile (x86 and x64) and Update for .NET Framework 4 (KB2468871)' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=239883.

like image 788
ahmadali shafiee Avatar asked Jul 07 '15 18:07

ahmadali shafiee


People also ask

How do you add prerequisites to a ClickOnce application?

Select the Publish pane. 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.

Where are ClickOnce files stored?

Every ClickOnce application installed on a local computer has a data directory, stored in the user's Documents and Settings folder. Any file included in a ClickOnce application and marked as a "data" file is copied to this directory when an application is installed.


1 Answers

You have a very wrong idea about what is possible in a ClickOnce deployment. The canonical MSDN page is this one. High-lighting the most significant sections in that web page:

Impact to the user's computer. With Windows Installer deployment, applications often rely on shared components, with the potential for versioning conflicts; with ClickOnce deployment, each application is self-contained and cannot interfere with other applications.
Security permissions. 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.

Does not affect shared components or other applications: Yes
Installation of shared files: No
Installation to Global Assembly Cache: No
Installation for multiple users: No
Install time registry access: Limited

These intentional restrictions were designed to make users feel good about installing .NET programs with ClickOnce. They don't need assistance from an administrator to get the program installed. And the installer cannot make drastic changes to the machine, the kind that cause other programs to malfunction. A very, very common problem with installers.

This is grossly incompatible with what you are trying to do. Both the .NET Framework and SQL Express are shared components and do require administrator access to install and do risk destabilizing a machine that already has .NET or SQL server installed.

So this simply cannot work. You can select them as Prerequisites but all that happens at install time is that the ClickOnce installer verifies that they are met. In other words, the machine must already have the correct versions of .NET and SQL Express installed. If it doesn't then the deployment will fail and the user gets the dialog that tells him where to download the installer. It is then entirely up to him (or his administrator) to download and run the installer. After which your ClickOnce install completes without trouble.

The deployment wizard is fairly crummy, it should have hidden the radio buttons at the bottom. Only "from the component vendor's web site" is a valid selection for these prerequisites. The bootstrapper .xml file format isn't sophisticated enough to limit the selection.

Only way to get ahead if you want to provide the user with these prerequisites included with the installer is to create a normal MSI installer.

like image 90
Hans Passant Avatar answered Sep 27 '22 19:09

Hans Passant