From ce62f5c4cc60955b017d57f3dc8598b7cdde8e3c Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Tue, 22 Mar 2016 22:29:52 +0000 Subject: [PATCH] Fixed Windows SDK selection when we cannot find VS reported version. Fixes issue #636, thanks to @dowitdo for the debugging and fix. --- src/Core/Toolchains/MSVCToolchain.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Core/Toolchains/MSVCToolchain.cs b/src/Core/Toolchains/MSVCToolchain.cs index b3bc3de7..5fd07b8e 100644 --- a/src/Core/Toolchains/MSVCToolchain.cs +++ b/src/Core/Toolchains/MSVCToolchain.cs @@ -178,6 +178,11 @@ namespace CppSharp ? windowsKitsSdks.Find(version => version.Value == kitsRootKey) : windowsKitsSdks.Last(); + // If for some reason we cannot find the SDK version reported by VS + // in the system, then fallback to the latest version found. + if (windowsKitSdk.Value == null) + windowsKitSdk = windowsKitsSdks.Last(); + includes.AddRange( CollectUniversalCRuntimeIncludeDirs(vsDir, windowsKitSdk, windowsSdkMajorVer));