I’ve created a winform application which is deployed/installed via « ClickOnce ».
I’ve notice an odd behavior when I add a prerequisite…
Initially, I have the following prerequisites:
- Windows Installer 3.1
- .Net Framework 3.5 SP 1
Once published, the users navigate to the publish.htm file and they see:
Name: Version: Publisher: and the “Install” link.
Once clicked, the application installs itself without a fuss!
Now…if I decide to add an additional prerequisite, such as the .Net Framework 3.5, I now have the following:
- Windows Installer 3.1
- .Net Framework 3.5
- .Net Framework 3.5 SP 1
Once publish, the publish.htm file shows an additional message underneath the Publisher section which is:
The following prerequisites are required:
* Windows Installer 3.1
* .NET Framework 3.5
* .NET Framework 3.5 SP1
If these components are already installed, you can launch the application now...
Question 1)
Why is that message all-of-a-sudden showing up?
Question 2)
In my second scenario, if the users click the Install link, instead of triggering the application install itself, it prompts a Save dialog to save the “setup.exe” file…which of course, that dialog was not showing in scenario one.
Why is the “Save dialog” being prompted to the users?
I’m sure I’m overlooking something here…
1.) The auto-generated publish.htm file does not include the installation of your prerequisites unless you choose to have them installed before your application. As soon as you specified a prerequisite from the Prerequisites screen on the Publish tab of your project, the publication process changes the look of the install page and modified the installation process initiated from the page.
If you do not specify any prerequisites (even if your application requires them), the publisher generates the first page with the application name, publisher and a simple install link. If you specify any prerequisites, the second page is generated.
2.) The user is being prompted to download the setup.exe file because the executable is a special application that drives the installation process of the necessary prerequisites. If you haven’t setup your application to auto-install your prerequisites (as in your first scenario) the installation link is the same as the “launch” link on the second install page.
If you inspect the launch link (or the install link of the first scenario) you will see that the link is pointing to a file that is named something like “yourProject.application”. The .application file is a special file (an XML document) that the Microsoft Installer uses to download, install and update a ClickOnce application– that’s why Windows Installer 3.1 is a prerequisite. I believe the reason why M$ decided to generate a setup.exe file to drive the prerequisite check and installation process is because if the user’s PC does not have Windows Installer 3.1 or higher, it wouldn’t know what to do with the .application file. An executable has to be launched to check and install any necessary components, including an updated version of Windows Installer.
If you choose to not include any prerequisites, the ClickOnce framework assumes that all of your prereqs will have been previously installed on the user’s PC (including Windows Installer) and can therefore attempt to download and launch the installation from the .application file.
It is also worth pointing out that ClickOnce applications can be only be installed from IE (well, you can use Firefox, and possibly Chrome, but the user will have to have a plugin installed.) This is because Windows Installer 3.1 updates IE so that it knows what to do with the .application file.