I deployed the ClickOnce Windows Forms application (app A)
Another application (application B) starts application A with the file name as a parameter. I am doing this with this code
var basePath = Environment.GetFolderPath(Environment.SpecialFolder.Programs); var location = String.Format(@"{0}\{1}\{2}\{3}", basePath, "MyCompany", "MyProduct", "MyApp.appref-ms"); var fileName = @"c:\temp\somefile.ext"; var uri = new Uri(fileName).ToString(); Process.Start(location, uri);
Appendix A captures the file name from AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[0] and displays the contents.
It works like a charm. However, now I want App B to wait for application A. to exit. But the call to Process.WaitForExit() returns immediately.
Is there a way to open the ClickOnce application and wait for it to exit? If necessary, I can change the way the application is opened, but the requirement is that I need to run the application as a ClickOnce application (I know that somewhere in my user profile folder AppData\Local\Apps\2.0\ exe exists and maybe running directly, but if I do that ApplicationDeployment.IsNetworkDeployed is false and ApplicationDeployment.CurrentDeployment is null, I lose the ability to update ClickOnce).
source share