#40990·WSL

WSL.Container API for existing containers and sessions

Author: hultqvistCreated Jul 3, 2026Updated Sep 30, 2026
Labelsfeaturewslc

Is your feature request related to a problem? Please describe. While testing the new SDK the program crashed. Next time it failed to create the container because one with that name already existed. Right now it does not appear that there is a way to manage already existing containers.

Describe the solution you'd like

csharp
public class Session
{
  public static void TerminateSession(string name);
  public IReadOnlyList<ContainerInfo> GetContainers();
  public Container? OpenContainer(string name); //Open existing container
}

class SessionSettings
{
  public bool OpenExisting { get; set; }
  public bool ReplaceExisting { get; set; }
}

class ContainerSettings
{
  public bool ReplaceIfExist { get; set; }
}

Describe alternatives you've considered

bash
wslc.exe --session MySession system session terminate
wslc.exe --session MySession container list --format json --all
wslc.exe --session MySession stop MyContainerName
wslc.exe --session MySession rm MyContainerName

Additional context Add any other context or screenshots about the feature request here.

NuGet: Microsoft.WSL.Containers 2.9.3 wslc 2.9.3.0