C# – Click Once, question regarding open it with arguments

cclickoncedeploymentinstallation

I created my ClickOnce application witch will install a small windows form application that consists on a WebBrowser control… I need to pass some arguments (this is made per client instalation) in order to open it correctly…

as an example, let's say that I need arg(0) to be the url to open, if I generate a normal Setup I will end up with the .exe file and all I need to do is:

myWebBrowser.exe "http://www.google.com"

but because I'm using ClickOnce method, I'm ending up with

myWebBrowser.appref-ms

if I open it it contains as normal the URL and other parameters

http://www.myWebSite.com/My.WebBrowser/MyWebBrowser.application#My Web Browser.application, Culture=neutral, PublicKeyToken=5f83fa0e3f8a8c2b, processorArchitecture=msil

and I can't pass arguments in it 🙁

What is the trick for this?

added

I do have "Allow parameters" active

alt text
(source: balexandre.com)

resources

I found out about this blog post… I will try it and post my findings

Best Answer

You should be able to use query string like normal...

http://someserver/folder/some.application?a=b&c=d&e=f

The trick is how your app looks for those arguments (plus it must have url arguments enabled in the publish properties) - you should check System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed - if set, look at either AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData (the first item in the array) or (simpler) the ActivationUri of the current deployment.

Related Topic