From bad903ac70fc4bcacae95f3459d88fc2a4cb47a6 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 13 May 2017 15:49:39 -0400 Subject: [PATCH] win: more robust parsing of SDK version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node-gyp/pull/1198 Fixes: https://github.com/nodejs/node-gyp/issues/1179 Reviewed-By: Ben Noordhuis Reviewed-By: João Reis --- lib/Find-VS2017.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Find-VS2017.cs b/lib/Find-VS2017.cs index a41a354f61..87e0a9c9bb 100644 --- a/lib/Find-VS2017.cs +++ b/lib/Find-VS2017.cs @@ -228,9 +228,12 @@ private static bool CheckInstance(ISetupInstance2 setupInstance2, ref StringBuil hasMSBuild = true; else if (id == "Microsoft.VisualStudio.Component.VC.Tools.x86.x64") hasVCTools = true; - else if (id.StartsWith(Win10SDKPrefix)) - Win10SDKVer = Math.Max(Win10SDKVer, UInt32.Parse(id.Substring(Win10SDKPrefix.Length))); - else if (id == "Microsoft.VisualStudio.Component.Windows81SDK") + else if (id.StartsWith(Win10SDKPrefix)) { + string[] parts = id.Substring(Win10SDKPrefix.Length).Split('.'); + if (parts.Length > 1 && parts[1] != "Desktop") + continue; + Win10SDKVer = Math.Max(Win10SDKVer, UInt32.Parse(parts[0])); + } else if (id == "Microsoft.VisualStudio.Component.Windows81SDK") hasWin8SDK = true; else continue;