-->

Thursday, May 8, 2008

Run ClickOnce Application as an Exe

In case anyone was interested, here's how to run a ClickOnce application as an Exe:

rundll32.exe dfshim.dll,ShOpenVerbApplication [Uri to .application file]

Why would you need this? Well, if you want to add a ClickOnce application as an External Tool in SQL 2005 Management Studio, if you need to fire it up it from a batch file (without opening a browser window), or anywhere else that requires a .exe extension, or where the shell-hooked ClickOnce shortcuts won't work.

3 comments:

MysoreMasalaDosa said...

Hi,

I tried this technique, both with the Uri and the path to the appref-ms shortcut file. However, it gives me an "Application cannot be started" error.

The error details read:

ERROR DETAILS
Following errors were detected during this operation.
* [6/15/2009 12:33:38 PM] System.IO.FileNotFoundException
- Could not find file '/ClickOnceTestApp.application'.
- Source: mscorlib
- Stack trace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileInfo.get_Length()
at System.Deployment.Application.ShellExposure.ParseAppShortcut(String shortcutFile, DefinitionIdentity& subId, Uri& providerUri)
at System.Deployment.Application.ApplicationActivator.ProcessOrFollowShortcut(String shortcutFile, String& errorPageUrl, TempFile& deployFile)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

Any idea why this happens ?

Sudhi.

RTA said...

It's hard to say based on what you've given me. What is the full command-line that you are running when it throws this error?

Raoul Rubin said...

Thanks! I was looking all over for this. It works great.