public static string GetWindowsSdkPath() { List <KeyValuePair <Version, string> > versionList = new List <KeyValuePair <Version, string> >(); string kitsRoot = Win32.GetKeyValue(true, "Software\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot10", "%ProgramFiles(x86)%\\Windows Kits\\10\\"); string kitsPath = Environment.ExpandEnvironmentVariables($"{kitsRoot}\\bin"); if (Directory.Exists(kitsPath)) { var windowsKitsDirectory = Directory.EnumerateDirectories(kitsPath); foreach (string path in windowsKitsDirectory) { string name = Path.GetFileName(path); if (Version.TryParse(name, out var version)) { versionList.Add(new KeyValuePair <Version, string>(version, path)); } } versionList.Sort((first, second) => first.Key.CompareTo(second.Key)); if (versionList.Count > 0) { var result = versionList[versionList.Count - 1]; if (!string.IsNullOrWhiteSpace(result.Value)) { return(result.Value); } } } return(string.Empty); }