diff --git a/CHANGELOG.md b/CHANGELOG.md index db126bd1c..c2f65fdbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. - Changed usage of obselete function GetDelegateForFunctionPointer(IntPtr, Type) to GetDelegateForFunctionPointer(IntPtr) - When calling C# from Python, enable passing argument of any type to a parameter of C# type `object` by wrapping it into `PyObject` instance. ([#881][i881]) - Added support for kwarg parameters when calling .NET methods from Python +- Changed method for finding MSBuild using vswhere ### Fixed diff --git a/setup.py b/setup.py index db2b4ae68..cabb176af 100644 --- a/setup.py +++ b/setup.py @@ -457,26 +457,20 @@ def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False): # trying to search path with help of vswhere when MSBuild 15.0 and higher installed. if tool == "msbuild.exe" and use_windows_sdk == False: try: - basePathes = subprocess.check_output( + basePaths = subprocess.check_output( [ "tools\\vswhere\\vswhere.exe", "-latest", "-version", - "[15.0, 16.0)", + "[15.0,)", "-requires", "Microsoft.Component.MSBuild", - "-property", - "InstallationPath", + "-find", + "MSBuild\**\Bin\MSBuild.exe", ] ).splitlines() - if len(basePathes): - return os.path.join( - basePathes[0].decode(sys.stdout.encoding or "utf-8"), - "MSBuild", - "15.0", - "Bin", - "MSBuild.exe", - ) + if len(basePaths): + return basePaths[0].decode(sys.stdout.encoding or "utf-8") except: pass # keep trying to search by old method. @@ -528,26 +522,20 @@ def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False): def _find_msbuild_tool_15(self): """Return full path to one of the Microsoft build tools""" try: - basePathes = subprocess.check_output( + basePaths = subprocess.check_output( [ "tools\\vswhere\\vswhere.exe", "-latest", "-version", - "[15.0, 16.0)", + "[15.0,)", "-requires", "Microsoft.Component.MSBuild", - "-property", - "InstallationPath", + "-find", + "MSBuild\**\Bin\MSBuild.exe", ] ).splitlines() - if len(basePathes): - return os.path.join( - basePathes[0].decode(sys.stdout.encoding or "utf-8"), - "MSBuild", - "15.0", - "Bin", - "MSBuild.exe", - ) + if len(basePaths): + return basePaths[0].decode(sys.stdout.encoding or "utf-8") else: raise RuntimeError("MSBuild >=15.0 could not be found.") except subprocess.CalledProcessError as e: diff --git a/tools/vswhere/vswhere.exe b/tools/vswhere/vswhere.exe index 3eb2df009..582e82868 100644 Binary files a/tools/vswhere/vswhere.exe and b/tools/vswhere/vswhere.exe differ