Skip to content

Update setup.py - use vswhere for msbuild 15+ #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ env:
addons:
apt:
sources:
- mono
- mono-libtiff-compat
- sourceline: deb http://download.mono-project.com/repo/ubuntu precise main
key_url: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF
packages:
- mono-devel
- ca-certificates-mono
Expand Down
14 changes: 13 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,19 @@ def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False):
path = spawn.find_executable(tool)
if path:
return path


if tool == "msbuild.exe":
vswhere = os.path.join("tools", "vswhere", "vswhere.exe")
basePathes = subprocess.check_output(
[vswhere, "-latest",
"-version", "[15.0, 16.0)",
"-requires", "Microsoft.Component.MSBuild",
"-property", "InstallationPath"]).splitlines()
if basePathes and basePathes[0] and os.path.exists(basePathes[0]):
path = os.path.join(basePathes[0],
"MSBuild", "15.0", "Bin", tool)
return path

# Search within registry to find build tools
try: # PY2
import _winreg as winreg
Expand Down
Binary file added tools/vswhere/vswhere.exe
Binary file not shown.