Skip to content

WslcService

Static entry point for service-level operations.

public static class WslcService
{
    public static IReadOnlyList<Component> GetMissingComponents();
    public static ServiceVersion GetVersion();
    public static void InstallWithDependencies();
    public static IAsyncActionWithProgress<InstallProgress> InstallWithDependenciesAsync();
}

WslcService.GetMissingComponents()

IReadOnlyList<Component> missing = WslcService.GetMissingComponents();
if (missing.Count == 0)
{
    Console.WriteLine("All required components are installed.");
}
else
{
    Console.WriteLine($"Missing: {string.Join(", ", missing)}");
}

WslcService.GetVersion()

ServiceVersion version = WslcService.GetVersion();
Console.WriteLine($"{version.Major}.{version.Minor}.{version.Revision}");

WslcService.InstallWithDependencies()

WslcService.InstallWithDependencies();

WslcService.InstallWithDependenciesAsync()

var install = WslcService.InstallWithDependenciesAsync();
install.Progress = (op, progress) =>
    Console.WriteLine($"install: {progress.Component} {progress.Progress}/{progress.Total}");
await install;