private async Task InstallWindowsFeaturesAsync() { bool rebootRequired = false; if (!WslExeExists()) { if (!await featureManager.IsFeatureEnabledAsync("Microsoft-Windows-Subsystem-Linux")) { await featureManager.EnableFeatureAsync("Microsoft-Windows-Subsystem-Linux"); rebootRequired = true; } } if (await GetWslVersionAsync() != 2) { if (!await featureManager.IsFeatureEnabledAsync("VirtualMachinePlatform")) { await featureManager.EnableFeatureAsync("VirtualMachinePlatform"); rebootRequired = true; } else { await Process.Start("wsl --set-default-version 2").WaitForExitAsync(); } } if (rebootRequired) { Console.WriteLine("Your computer needs to reboot. Press any key to reboot now..."); Console.ReadKey(true); await operatingSystem.SetupRunOnNextBootAsync(); operatingSystem.RebootNow(); } }