0 out of 8 rated this helpful - Rate this topic

How to: Install Prerequisites with a ClickOnce Application

All ClickOnce applications require that the correct version of the .NET Framework is installed on a computer before they can be run; many applications have other prerequisites as well. When publishing a ClickOnce application, you can choose a set of prerequisite components to be packaged along with your application. At installation time, a check will be performed for each prerequisite to determine if it already exists; if not it will be installed prior to installing the ClickOnce application.

Instead of packaging and publishing prerequisites, you can also specify a download location for the components. For example, rather than including prerequisites with every application that you publish, you might use a centralized file share or Web location that contains the installers for all of your prerequisites—at install time, the components will be downloaded and installed from that location.

Prerequisites are managed in the Prerequisites dialog box, accessible from the Publish pane of the Project Designer.

NoteNote

In addition to the predetermined list of prerequisites, you can add your own components to the list. For more information, see Creating Bootstrapper Packages.

To specify prerequisites to install with a ClickOnce application

  1. With a project selected in Solution Explorer, on the Project menu click Properties.

  2. Select the Publish pane.

  3. Click the Prerequisites button to open the Prerequisites dialog box.

  4. In the Prerequisites dialog box, make sure that the Create setup program to install prerequisite components check box is selected.

  5. In the Prerequisites list, check the components that you wish to install, and then click OK.

    The selected components will be packaged and published along with your application.

To specify a different download location for prerequisites

  1. With a project selected in Solution Explorer, on the Project menu click Properties.

  2. Select the Publish pane.

  3. Click the Prerequisites button to open the Prerequisites dialog box.

  4. In the Prerequisites dialog box, make sure that the Create setup program to install prerequisite components check box is selected.

  5. In the Specify the install location for prerequisites section, select Download prerequisites from the following location.

  6. Select a location from the drop-down list, or enter a URL, file path, or FTP location, and then click OK.

    NoteNote

    You must make sure that installers for the specified components exist at the specified location.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
ClickOnce does not update prerequisites when an application updates
I agree.  This is a significant problem for us.  It presents users with a very unprofessional experience, and leaves developers scrambling.

1.  Why does ClickOnce not update prerequisites when an application updates?
2.  Why does this article not emphasize this fact, rather than ignore it?

ClickOnce does not update prerequisites when an application updates
Although this article states that prerequisites are checked for and installed before a ClickOnce app is installed, it fails to mention that this does not occur when a ClickOnce application updates
It is hard to believe this information was not omitted intentionally (the wording carefully mentions 'at installation time' and is silent about 'at update time'). If so, such a tactic is in complete disregard of the value of time of developers who have adopted ClickOnce, and collectively would total thousands of wasted work hours. Withholding information with the aim of retaining developers will likely have the opposite effect in my opinion. 

The fact that ClickOnce does not install prerequisites on update can prove to be a headache as your 'available off-line' ClickOnce application moves through different versions of the .NET framework, from 2.0 to 3.5 to 3.5 SP1 and then 4 client profile or 4. As your prerequisites change your application will need to be re-installed. 
In our case the main problem was moving to Visual Studio 2010 and the requirement to upgrade Crystal Reports. Our users only know how to run the application from the application shortcut on the desktop or program files menu.
To solve this problem, I wrote code that tried to open a Crystal report on application startup. This would throw an exception when Crystal Reports for VS 2010 was not installed. In the exception handler, I provided instructions for the user to re-install the application and opened Internet Explorer on the publish page. Many users managed this, but it was all too hard for some.
 
Advertisement