views:

92

answers:

5

Hi

I'm 3-months new to WPF and trying to build a launchy app for fun (app launcher type thingie by name).

I can't seem to launch ClickOnce applications by Process name.

In other words:

  • Process.Start("Firefox"); // will work
  • Process.Start("MetroTwit"); // a ClickOnce app - will NOT work

I've read that you should be calling it by URL? But where do you find out the URL of the installed clickonce apps?

Ideally I'd want to refresh a List of apps installed on the users system (program files & clickonce & AIR clients) every minute or so and do fuzzy search on type etc.

Help greatly appreciated.

+2  A: 

Process.Start is equivalent to doing Start, Run.. then entering some text there. You have to enter an executable that can be found using the PATH environment variable, or you can specify the URL that points to the .application file you want to run. E.g. http://publish.url.com/publish/myapp.application.

Hope that helps!

Kieren Johnstone
So where do you find the urls of already installed clickonce app in C#? ta.
keyle
The URL is the deployment URL: as far as I know there is no way to enumerate the list of ClickOnce apps. See here for some discussion http://www.windowsdevelop.com/clickonce-setup--deployment-projects/how-can-i-get-a-list-of-clickonce-installed-programs-on-a-given-client-2342.shtml
Kieren Johnstone
Thanks for that. So that would mean there is no way I could build a reliable app launcher that includes ClickOnce Applications... Mmm.
keyle
Nevermind the right way was to follow @Nir and parse the content of the startmenus. Thanks!
keyle
+1  A: 

The URL you are looking for is the URL used for installation. Yes, it sounds strange. ClickOnce is a bit strange. Unfortunately ClickOnce does not install to the Program Files folder but instead burries itself in a users AppData Folder. Depending on whether you installed via the web or through the CD/DVD option and will determine how easy it is to resolve this. Good luck!

Jay
You can only get the installation URL if the application is online-only.
RobinDotNet
A: 

To add to @Kieren's answer: the reason that Process.Start("Firefox") works is that Firefox installs itself in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe key in the registry.

Tim Robinson
+1  A: 

There are two kinds of ClickOnce applications (set when publishing the app) those that are installed on the start menu and those that can only be run from the web url.

Applications that are installed in the start menu can be found (surprisingly) under the start menu folder, they have special type of shortcut with the APPREF-MS extension.

You can use Process.Start to run the APPREF-MS file.

Application that are configured to only run from the web url, well, you have to run them from the web url.

Nir
This is fantastic, I was parsing the different "uninstall" registered apps in the registry... Not fun... But your way is much simpler. Just parse the content of the 2 start menus (local / global), look for .lnk and .appref-ms files. And I can just Process.Start(@"C:\...App.APPREF-MS") -- Thanks!!
keyle
A: 

You don't even need to parse the start folders. The location of that startup is here:

shortcutName = 
  string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs),
                "\\", publisher_name, "\\", product_name, ".appref-ms");

Where publisher_name and product_name are the ones set in the Options dialog in the publish properties.

RobinDotNet