Skip to content

Commit 5134cbf

Browse files
authored
Merge pull request #758 from pythonnet/msbuild-fix-vs2017
Update setup.py for msbuild requirements
2 parents 2857071 + 3dd0446 commit 5134cbf

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

setup.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,16 @@ def _install_packages(self):
329329
self.debug_print("Updating NuGet: {0}".format(cmd))
330330
subprocess.check_call(cmd, shell=use_shell)
331331

332-
cmd = "{0} restore pythonnet.sln -MSBuildVersion 14 -o packages".format(nuget)
333-
self.debug_print("Installing packages: {0}".format(cmd))
334-
subprocess.check_call(cmd, shell=use_shell)
332+
try:
333+
# msbuild=14 is mainly for Mono issues
334+
cmd = "{0} restore pythonnet.sln -MSBuildVersion 14 -o packages".format(nuget)
335+
self.debug_print("Installing packages: {0}".format(cmd))
336+
subprocess.check_call(cmd, shell=use_shell)
337+
except:
338+
# when only VS 2017 is installed do not specify msbuild version
339+
cmd = "{0} restore pythonnet.sln -o packages".format(nuget)
340+
self.debug_print("Installing packages: {0}".format(cmd))
341+
subprocess.check_call(cmd, shell=use_shell)
335342

336343
def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False):
337344
"""Return full path to one of the Microsoft build tools"""

0 commit comments

Comments
 (0)