From 3dd0446f9bc41c206121a2f77dcdba78ae824cda Mon Sep 17 00:00:00 2001 From: Denis Akhiyarov Date: Thu, 1 Nov 2018 09:05:05 -0500 Subject: [PATCH] Update setup.py msbuild fix for vs2017 - do not specify msbuild version --- setup.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 0c28a80f5..1b6f07ea6 100644 --- a/setup.py +++ b/setup.py @@ -329,9 +329,16 @@ def _install_packages(self): self.debug_print("Updating NuGet: {0}".format(cmd)) subprocess.check_call(cmd, shell=use_shell) - cmd = "{0} restore pythonnet.sln -MSBuildVersion 14 -o packages".format(nuget) - self.debug_print("Installing packages: {0}".format(cmd)) - subprocess.check_call(cmd, shell=use_shell) + try: + # msbuild=14 is mainly for Mono issues + cmd = "{0} restore pythonnet.sln -MSBuildVersion 14 -o packages".format(nuget) + self.debug_print("Installing packages: {0}".format(cmd)) + subprocess.check_call(cmd, shell=use_shell) + except: + # when only VS 2017 is installed do not specify msbuild version + cmd = "{0} restore pythonnet.sln -o packages".format(nuget) + self.debug_print("Installing packages: {0}".format(cmd)) + subprocess.check_call(cmd, shell=use_shell) def _find_msbuild_tool(self, tool="msbuild.exe", use_windows_sdk=False): """Return full path to one of the Microsoft build tools"""