简体   繁体   中英

Launch a second instance of a WPF application from within the first

If our standalone app were just a downloaded .exe file (ie 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.)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM