October 25, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Deploying Separate User/Site Configurations with ClickOnce

  • February 25, 2009
  • By Matt Goebel and Rachel Baker
  • Send Email »
  • More Articles »

Next, you will configure the ClickOnce deployment to accept and use parameters. Click on the "Options..." button to pull up the "Publish Options" dialog.

Figure 13: The Publish Options dialog

By default, the option to allow URL parameters is disabled. Enable it by checking the box next to it.

Figure 14: Configuring the application to accept URL parameters

Click 'OK' and exit out of the dialog. The ClickOnce deployment is now configured.

Click the "Publish Now" button to build the installation package. Once the build and publish are complete, navigate to the following URL in your browser. (Note: A browser window may launch automatically after the publish process is complete.)

http://localhost/ClickOnceDeployment/
   ClickOnce%20Using%20Parameters.application?title=Wow

The key piece of information in this URL is the "?title=Wow". This parameter will instruct the application to change the title of the form once it is launched. Accept any prompts you receive and install the application. The application will now launch. Notice that the form's title is the value of the parameter passed in the URL.

Figure 15: The application with parameter "Wow"

Close the application, change the parameter to something else, for example: "?title=ClickOnce Rocks".

Figure 16: The application with parameter "ClickOnce Rocks"

Close the application. Via the Start menu, launch the application as you would any other desktop application. You'll notice that the text of the form is "Main Form", which is the title you set during design.

Figure 17: The application launched from the Start menu instead of a URL

In this scenario, you could retain the information passed in the initial URL by storing it into the application's configuration file instead. You could send users different URLs that will configure the application correctly. You could even create a simple web page that allows users to select different options (for example, background color or language) and use the inputs to construct the correct URL with each of the options as parameters. Whichever way you construct the URL, you can store these parameters in the application's configuration file via code and use the configuration to set up the application on launch.

Conclusion

ClickOnce is a powerful tool for deploying and updating applications with a rich, responsive user experience. You examined two different methods for deploying different application configurations to your users. The first method requires separate installation packages for different configurations. The second method requires customized URL parameters and the use of code to parse and store the parameters as application settings.

About the Authors

Matt Goebel is a manager with Crowe Horwath LLP in the Indianapolis, Indiana, office. He can be reached at 317.208.2555 or matt.goebel@crowehorwath.com.

Rachel Baker is a senior developer with Crowe Horwath LLP in the Oak Brook, Illinois, office. She can be reached at 630.990.4434 or rachel.baker@crowehorwath.com.


Tags: .NET



Page 5 of 5



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel