Click here to Skip to main content
Click here to Skip to main content

Launching a ClickOnce Application from Another ClickOnce Application

, 23 May 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
How to launch a ClickOnce application from another ClickOnce application


ClickOnce applications do a great job of isolating applications from each other. This was done for two reasons, security and maintainability. Firstly, it allows for greater security since the .NET Framework manages security via code access policies. Secondly, it increases maintainability by preventing the problems with "DLL hell". But this does pose a problem when one wants to launch the application. While it is installed on the hard drive, the framework installs it in different locations for every user.

Microsoft solved this problem by creating a special type of shortcut, called an "application reference" that is used in the start menu when a ClickOnce application is installed locally. Great, now we can launch an application from the start menu, but what if we want to launch it from another application?

To answer this problem, I started where many of you are thinking. I will just use the URL to the .application manifest file on the server. Just do a System.Diagnostics.Process.Start on the URL and I am good to go. While this will work fine in an always connected scenario, it doesn't work if the application needs to run in offline mode.

For those applications, I suggest doing a little bit of thievery. Since the application reference (*.appref-ms) that is created in the start menu will launch the application (if it is installed) for any user on any computer (with the .NET Framework 2.0 installed), all we need to do is steal it out of the start menu and embed it in our launching application.

This technique is useful for applications that run in an online/offline mode. For online only application, I suggest using just the URL.

The Code

  1. Create the Client application
    1. Create a new Windows Application in VS.NET 2005
    2. Call it ClickOnceClient
    3. Publish it, with all the default settings
    4. Install it
  2. Find the application reference file from the start menu
    1. Using file explorer, navigate to C:\Documents and Settings\(user)\Start Menu\Programs\(company)
  3. Create the Launcher application
    1. Create a new Windows Application in VS.NET 2005
    2. Call it ClickOnceLauncher
    3. Add the application reference file for the client to the project
    4. Set its "Copy to Output Directory" property to "Copy always"
    5. Set its "Build Action" property to "Content"
    6. Add a button to the form
    7. In the click event of the button, add a Process.Start for the file you just copied in
    8. Publish it, with all the default settings
    9. Install it
    10. Run it


  • 2006/05/23 Created


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
United States United States
Shawn is an Orlando FL based developer and president of the Orlando .NET Users Group ( Currently he is doing intranet & smart client development at a local fortune 500 company and teaches at the Florida Institute of Technology. Shawn started his career at his family business in Port St. Lucie Florida while working on his undergraduate degree in Business Administration at the University of Central Florida and after a year off Shawn moved to Orlando to pursue a Masters degree in Management Information Systems at UCF. Before graduating Shawn worked as an intern at the company he currently works full time for. Currently Shawn is working on a second Masters degree in Computer Science at FIT. Besides his work, Shawn enjoys volunteering with local organizations.

Comments and Discussions

Generalrun at startup PinmemberDiego.Veras4-Oct-08 5:26 
GeneralRe: run at startup Pinmembersaw12346-Oct-08 0:26 
AnswerIf you have 3.5 SP1, Process.Start({ClickOnce URL}) works fine in Offline mode Pinmemberhhawork18-Sep-08 9:16 
GeneralClick Once Launcher - Easy Method PinmemberMember 472153615-Apr-08 1:46 
GeneralRe: Click Once Launcher - Easy Method Pinmembertsk2229-Apr-08 7:52 
GeneralClickOnce silent PinmemberEli Gazit16-Oct-07 3:17 
GeneralRe: ClickOnce silent PinmemberEli Gazit30-Oct-07 22:53 
Generalthere is a problem for this approach Pinmemberstevendonline10-Nov-06 9:11 
GeneralRe: there is a problem for this approach PinmemberDTMxxLLC30-Aug-07 17:28 
GeneralI like the idea Pinmember_alank26-Sep-06 10:38 
GeneralRe: I like the idea Pinmembersaw123428-Sep-06 0:27 
GeneralRe: I like the idea Pinmember_alank28-Sep-06 2:47 
Questionwhy launch this way ? PinmemberBillWoodruff1-Jun-06 10:09 
AnswerRe: why launch this way ? Pinmembersaw12345-Jun-06 8:43 
GeneralRe: why launch this way ? PinmemberBillWoodruff5-Jun-06 9:16 
GeneralRe: why launch this way ? Pinmembersaw123412-Jun-06 2:49 
GeneralRe: why launch this way ? Pinmembertravis_1121121430-Apr-07 23:52 
GeneralRe: why launch this way ? Pinmembersaw12341-May-07 0:17 
GeneralRe: why launch this way ? Pinmembertravis_112112141-May-07 2:04 
GeneralRe: why launch this way ? Pinmembersaw12341-May-07 16:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 23 May 2006
Article Copyright 2006 by saw1234
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid