Skip to content

Commit cae7a1e

Browse files
author
denfromufa
authored
Update setup.py
1 parent af62a1a commit cae7a1e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

setup.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,18 @@ def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False):
281281
path = spawn.find_executable(tool)
282282
if path:
283283
return path
284-
284+
285+
if tool == "msbuild.exe":
286+
basePathes = subprocess.check_output(
287+
["vswhere", "-latest",
288+
"-version", "[15.0, 16.0)",
289+
"-requires", "Microsoft.Component.MSBuild",
290+
"-property", "InstallationPath"]).splitlines()
291+
if basePathes and basePathes[0] and os.path.exists(basePathes[0]):
292+
path = os.path.join(basePathes[0],
293+
"MSBuild", "15.0", "Bin", tool)
294+
return path
295+
285296
# Search within registry to find build tools
286297
try: # PY2
287298
import _winreg as winreg

0 commit comments

Comments
 (0)