How to create a Process that outlives its parent

There's no reason why a process started with Process.Start should automatically die when the launcher exits. My guess is that you're doing something odd in the updater.

I've written an updater doing exactly this kind of thing before, and it's been fine.

For example:

Launcher.cs:

using System;
using System.Diagnostics;

class Launcher
{
    static void Main()
    {
        Console.WriteLine("Launching launchee");
        Process.Start("Launchee.exe");
        Console.WriteLine("Launched. Exiting");
    }
}

Launchee.cs:

using System;
using System.Threading;

class Launchee
{
    static void Main()
    {
        Console.WriteLine("       I've been launched!");
        Thread.Sleep(5000);
        Console.WriteLine("       Exiting...");
    }
}

Compile both of them, separately, and run Launcher.exe. The "launchee" process definitely lasts longer than the launcher.


It seems that the problem you are seeing has a different reason because the Process class will not kill any processes started using Process.Start when your application exits.

See this simple sample program, the calculator will stay open:

using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        Process.Start(@"C:\windows\system32\calc.exe");
    }
}