Skip to content

Commit bad903a

Browse files
committed
win: more robust parsing of SDK version
PR-URL: #1198 Fixes: #1179 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: João Reis <[email protected]>
1 parent 241752f commit bad903a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: lib/Find-VS2017.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,12 @@ private static bool CheckInstance(ISetupInstance2 setupInstance2, ref StringBuil
228228
hasMSBuild = true;
229229
else if (id == "Microsoft.VisualStudio.Component.VC.Tools.x86.x64")
230230
hasVCTools = true;
231-
else if (id.StartsWith(Win10SDKPrefix))
232-
Win10SDKVer = Math.Max(Win10SDKVer, UInt32.Parse(id.Substring(Win10SDKPrefix.Length)));
233-
else if (id == "Microsoft.VisualStudio.Component.Windows81SDK")
231+
else if (id.StartsWith(Win10SDKPrefix)) {
232+
string[] parts = id.Substring(Win10SDKPrefix.Length).Split('.');
233+
if (parts.Length > 1 && parts[1] != "Desktop")
234+
continue;
235+
Win10SDKVer = Math.Max(Win10SDKVer, UInt32.Parse(parts[0]));
236+
} else if (id == "Microsoft.VisualStudio.Component.Windows81SDK")
234237
hasWin8SDK = true;
235238
else
236239
continue;

0 commit comments

Comments
 (0)