March 7, 2021
Hot Topics:

Deploying Separate User/Site Configurations with ClickOnce

  • By Matt Goebel and Rachel Baker
  • Send Email »
  • More Articles »

ClickOnce in .NET is a technology that allows you to marry the rich user experience of Windows Forms applications with the deployment and update advantages of Web applications. What do you do, however, when you want to deploy different application configurations to different sets of users? For example, you might have a Power User version of the application to be distributed to a set of users who require advanced features and a normal version of the application to be distributed to a set of users who only require basic features. you will learn two different methods for distributing different application configurations to users.

Method 1: Installing and Updating from Different Locations

The first method for deploying different configurations via ClickOnce is to set up separate installations for each configuration of the application and pointing all versions of the application to one, common update location. This method can cause quite a bit of maintenance overhead because you have to maintain a different installation for each configuration that you have. However, once you set up the installations, you can streamline the process of deploying updates because all of the applications (regardless of the original installation location) will update from the same place while maintaining the initial configurations.

To follow the demonstration below, you will need to set up the following:

  • Create the folder "C:\Temp\ClickOncePublishFolder"
  • Create the folder "C:\ClickOnceInstallationPath"
  • Create the folder "C:\ClickOnceUpdatePath"
  • Configure "ClickOnceInstallationPath" to be a shared folder with the same name
  • Configure "ClickOnceUpdatePath" with IIS to be a virtual directory with the same name

Instructions for setting up a shared folder and a virtual directory for your operating system and version of IIS can be found via Web search and are beyond the scope of this article.

Once you have the directory structure in place, open Visual Studio (2005 or later) and create a new Windows Forms project with default settings. Change the default form in some way to distinguish it from the blank form. In the example below, the form is resized and the title changed to "MainForm".

Click here for a larger image.

Figure 1: Basic Windows Forms application

Right-click on the project (*.csproj) in Solution Explorer and select Properties. Navigate to the Publish tab. Enter the location you created for the Publishing Folder, "C:\Temp\ClickOncePublishFolder". This is where the application files will be placed when you click the "Publish" button.

Next, enter the location from which the ClickOnce package will be installed. You will use the shared folder you created (mocking a shared directory on a server), "\\servername\ ClickOnceInstallationPath". You will need to replace "servername" with the name of your PC or the server where you are deploying.

Click here for a larger image.

Figure 2: Configure ClickOnce deployments via the Publish tab

The next step is to configure the location that the application will use for updates. By default, this will be the same location as the installation folder. To configure the update location, click on the "Updates..." button on the 'Publish' tab.

Page 1 of 5

This article was originally published on February 25, 2009

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date