Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Open clickonce application if installed
 

Open clickonce application if installed

An external application need to start my clickonce application if it is installed, so the questions are:

1) How can i detect if my clickonce is installed on a pc?

2) How can i excecute my application?

Paolo72  Thursday, July 16, 2009 10:38 AM
I have found this solution (not very good but it is the only one).

To find if the application is installed i search in the "program start menu"

string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), 
    "Programs\\<company>");
path = Path.Combine(path, "<app name>") + ".appref-ms";
if (!File.Exists(path))
{
    // TODO: launch application (es: Process.Start...)
}



If you have to pass parameters you can open as text this link and grab the url of the publication server and append your parameters:
if (!File.Exists(path))
{
    // http://www.mysite.com/MyApp.application#MyApplication.app, Culture=neutral, 
    //    PublicKeyToken=afc42bbb4bb73e70, processorArchitecture=msil
    string content = File.ReadAllText(path);
    path = content.Split('#')[0];
}
// TODO: append you parameter to 'path'



If there are best solutions please notify me, bye!
  • Marked As Answer byPaolo72 Friday, July 17, 2009 8:07 AM
  • Edited byPaolo72 Friday, July 17, 2009 8:11 AM
  •  
Paolo72  Friday, July 17, 2009 8:07 AM
I have found this solution (not very good but it is the only one).

To find if the application is installed i search in the "program start menu"

string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), 
    "Programs\\<company>");
path = Path.Combine(path, "<app name>") + ".appref-ms";
if (!File.Exists(path))
{
    // TODO: launch application (es: Process.Start...)
}



If you have to pass parameters you can open as text this link and grab the url of the publication server and append your parameters:
if (!File.Exists(path))
{
    // http://www.mysite.com/MyApp.application#MyApplication.app, Culture=neutral, 
    //    PublicKeyToken=afc42bbb4bb73e70, processorArchitecture=msil
    string content = File.ReadAllText(path);
    path = content.Split('#')[0];
}
// TODO: append you parameter to 'path'



If there are best solutions please notify me, bye!
  • Marked As Answer byPaolo72 Friday, July 17, 2009 8:07 AM
  • Edited byPaolo72 Friday, July 17, 2009 8:11 AM
  •  
Paolo72  Friday, July 17, 2009 8:07 AM
Looks right to me!

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Tuesday, July 21, 2009 6:11 AM

You can use google to search for other answers

Custom Search

More Threads

• Preventing a clickonce installation based on OS version
• Microsoft Visual C++ Runtime Library Error on Vista
• ClickOnce deployment on thin client / terminal service
• autoupdater for VS deployments
• can I add shortcuts to start/programs/myApp with ClickOnce?
• Where to temper
• publishing Window Application in .Net
• setup/deployment using windows Installer
• Automating Manual Install of Multiple Update files
• Deploy Project,... Make Uninstall