Subscribe Bookmark RSS Feed

Clickonce Application

kyle_lamson

Community Trekker

Joined:

Mar 17, 2016

Does anyone have the syntax needed to run a clickonce application. I've tried

RunProgram(executable("clickonce application"));

Which I figured wouldn't work. Are there any other options?

2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

The following might be of use, it was taken from:

http://www.brad-smith.info/blog/archives/535

Starting ClickOnce applications

Unlike normal executables, applications deployed using ClickOnce are started using a bootstrapper (which is normally handled by the shell). This includes applications written in Windows Forms, WPF or Silverlight. Shortcuts to ClickOnce apps have the extension .appref-ms (rather than .lnk for regular shortcuts), and these files are not recognised by the start command (as in the previous example).

Thankfully, they can be run using the following syntax:

1rundll32.exe dfshim.dll,ShOpenVerbShortcut [path to appref-ms file]

Where [path to appref-ms file] is the full path to the ClickOnce shortcut file. The path may include environment variables such as %USERPROFILE% if, for example, you want to point to a shortcut on the user’s desktop.

How does this work?

  • The rundll32 command executes a function in a Win32 DLL as if it were an executable file. You might want to use this when you have a function which is predominantly called from code (but still operates independently), if you want to avoid creating many executables when a single DLL will suffice, or to deliberately obfuscate a command that users are not intended to start.
  • dfshim.dll is responsible for much of the functionality in ClickOnce; it contains functions to install, remove, start and update applications, and is distributed as part of the .NET Framework.
  • The name of the function we want is ShOpenVerbShortcut, which is the same function that the windows shell uses to run .appref-ms shortcut files. You simply pass a path to the function and it takes care of the rest.
Jim
kyle_lamson

Community Trekker

Joined:

Mar 17, 2016

I figured it out after enough poking around.

web("clickonce application.appref-ms");