5

If our standalone app were just a downloaded .exe file (i.e. deployed using windows installer), it would be fairly simple to have a running instance launch a second instance using System.Diagnostics.Process.Start. Unfortunately, our WPF application is deployed VIA ClickOnce, so there's no local file system path to it as far as I know.

How can I launch a second instance of a running ClickOnce app? (And pass it command line parameters if possible.)

Alain
  • 26,663
  • 20
  • 114
  • 184
  • Not a duplicate of this http://stackoverflow.com/questions/1890634/clickonce-app-does-not-start-through-process-startx-abc-with-abc-associate but it might help – Alex Aug 02 '12 at 14:09
  • I'm just curious: why do you need to have two instances of your application? – niao Aug 02 '12 at 14:12
  • @PiotrPtak My application loads up all the details and configuration options for a given 'Program' (A complex object model with roughly 20 modules each with a dozen or so tables, lists and properties). If the user wishes to load up a second 'Program' side by side, the simplest solution is for them to start up a second instance. They want to make that easier by launching a second instance from the first by having a clickable a 'link' wherever another 'Program' is referenced. – Alain Aug 02 '12 at 14:29
  • If you know the deployment URL of the application, you can just do a Process.Start on it, and it will install or run it. – RobinDotNet Aug 25 '12 at 07:33

2 Answers2

6

You're incorrect: there is a local path, under your local Application Data folder. Alternatively, you can relaunch the application using the Uri. In short, you should be able to work out the launch path for your application (maybe using Environment.CommandLine or System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName) as you would for a regular application, and use that.

Dan Puzey
  • 33,626
  • 4
  • 73
  • 96
3

well, there IS a local filesystem path when you deploy it via clickonce. Try

yourWindow.GetType().Assembly.Location

-> this will give you the full path to your assembly.

Joachim Kerschbaumer
  • 9,695
  • 7
  • 49
  • 84