Start an offline ClickOnce Application and wait for Exit

Error processing SSI file

Answers

  1. Ronald

    • 2016/10/16

    The problem is that starting the appref-ms process does not actually start the application it starts the deployment manifest, which then launches the application itself, so the process you are starting exits straight away.

    You can add a check to see when you application has started if you know the name (which I assume you do) like this:

    string myAppName = "YourAppName";
    DateTime startTime = DateTime.Now;
    int newProcessId = 0;
    List<int> runningProcessIds = new List<int>();
    
    //find all the running processes and record their Ids
    foreach (void proc_loopVariable in Process.GetProcessesByName(myAppName)) {
        proc = proc_loopVariable;
        runningProcessIds.Add(proc.Id);
    }
    
    //start the new process
    Process.Start(location);
    
    //wait for the new application to be started
    while (!(Process.GetProcessesByName(myAppName).Count != runningProcessIds.Count)) {
        //timeout if we have not seen the application start
        if ((DateTime.Now - startTime).TotalSeconds > 30)
            break; 
    }
    
    //loop through all the running processes again to find the id of the one that has just started
    foreach (void proc_loopVariable in Process.GetProcessesByName(myAppName)) {
        proc = proc_loopVariable;
        if (!runningProcessIds.Contains(proc.Id)) {
            newProcessId = proc.Id;
            break; 
        }
    }
    
    //wait for the application to finish
    Process.GetProcessById(newProcessId).WaitForExit();
    
    Debug.WriteLine("Finished");
    
  2. Flores

    • 2021/2/4

    my suggestion would be to use Mutex in App A, and let App B check and wait for it. This is the cleanest way from my point of view.

  3. Ahmir

    • 2017/2/24

    Start an offline ClickOnce Application and wait for Exit. Ask Question Asked 7 years, 6 months ago. However, now I want App B to wait for App A to exit.

  4. Rizzi

    • 2020/12/25

    A bootstrap loader to execute a ClickOnce application - written in C#. process with this command line and wait for the process to exit.

  5. Julien

    • 2020/4/15

    my suggestion would be to use Mutex in App A, and let App B check and wait for it. This is the cleanest way from my point of view.

    App A does this when starts:

        private static Mutex mutex;
    
        public static void Main()
        {
            // if you want your app to be limited to a single instance
            // across ALL SESSIONS (multiple users & terminal services), then use the following line instead:
            // string mutexName = string.Format("Global\\{0}", ProgramInfo.AssemblyGuid);
            var mutexName = string.Format("Local\\{0}", SOME_SHARED_GUID);
            mutex = new Mutex(true, mutexName, out singleInstance);
    
            if (singleInstance == false)
            {
    
               // that means your app has more than one instance running
               // you need to decide what to do here.
            }
    
            // rest of initialization code
    
            Application.Run();
    
            // release the mutex so App B can continue
            mutex.ReleaseMutex();
        }
    

    and App B just waits for the mutex to be released:

    Process.Start(location, uri);
    Thread.Sleep(5000);  // give it 5 seconds or so to check for updates and start
    var mutexName = string.Format("Local\\{0}", SOME_SHARED_GUID);
    mutex = new Mutex(false, mutexName);
    mutex.WaitOne();
    
  6. Forrest

    • 2019/6/26

    To make a ClickOnce application available online or offline. With a project selected in Solution Explorer, on the Project menu, click Properties. Click the Publish tab. In the Install Mode and Settings area, click the The application is available offline as well option button. When installed, the application adds entries to the Start menu and

  7. Alden

    • 2016/11/21

    This application needs to run offline as well as online. Can I call a clickonce application and pass in commandline arguements?

  8. Ameer

    • 2015/11/25

    Cannot start the application. There is not enough available space on the disk. The hard disk is full. Clear off space and try to run the application again. Too many deployed activations are attempting to load at once. ClickOnce limits the number of different applications that can start at the same time.

  9. Isaiah

    • 2021/6/6

    When you choose The application is available offline as well, the application adds entries to the Start menu and the Add or Remove Programs 

  10. Brahimi

    • 2021/10/24

    In this article. When a ClickOnce application is installed for both online and offline use, an entry is added to the Start menu and the Add or Remove Programs list. By default, the display name is the same as the name of the application assembly, but you can change the display name by setting Product name in the Publish Options dialog box.

  11. Colt

    • 2016/10/18

    application) and the manifest folder containing the deployment files (MyApp_1_0_0_0). To begin a manual update, copy the deployment folder and rename it with 

  12. Jaxxon

    • 2018/6/1

    Starting in .NET Framework 3.5 SP1, it is possible to pass command-line arguments to an offline ClickOnce application. If you want to supply arguments to the application, you can pass in parameters to the shortcut file with the .APPREF-MS extension. That sounds like exactly what I want! Problem is, I’ve already tried that and it doesn’t work.

  13. Caputo

    • 2017/11/3

    C# Start An Offline ClickOnce Application And Wait For WaitForExit() returns instantly. Is there a way to open a ClickOnce App and wait for it to exit?

  14. Gunner

    • 2019/2/12

    This application needs to run offline as well as online. Can I call a clickonce application and pass in commandline arguements? I chose clickonce to help with the updates and force users to always use the latest version, this assists us with auditors and helps push out the latest version as well. The only thing missing is the command line option.

  15. Miguel

    • 2020/9/11

    Users should never run the application and end up in an environment where the are sitting idle waiting for the application to finish doing something.

  16. Castelli

    • 2017/9/8

    To resolve the issue, terminate the dfcvc.exe process, close the tested application, enable the option in TestComplete and launch the 

  17. Cyrus

    • 2016/3/23

    tool and follow links to install the application via ClickOnce. Leave the default product code, right-click the Package node from the.

  18. Martinez

    • 2016/2/2

    Start an offline ClickOnce Application from command line and wait for Exit a clickonce application by a command (from a batch file) and need to wait 

Comments are closed.

More Posts