From 2717bbe149c5971870e76aac7aa95a617c26998e Mon Sep 17 00:00:00 2001 From: James Date: Mon, 11 Dec 2023 20:06:14 +0100 Subject: [PATCH] better ux for VS not found error (#15250) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * better ux * improve * Update conan/tools/microsoft/visual.py Co-authored-by: Rubén Rincón Blanco --------- Co-authored-by: Rubén Rincón Blanco --- conan/tools/microsoft/visual.py | 4 +++- conans/model/conf.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/conan/tools/microsoft/visual.py b/conan/tools/microsoft/visual.py index bc02571b3fa..e485376ca4d 100644 --- a/conan/tools/microsoft/visual.py +++ b/conan/tools/microsoft/visual.py @@ -232,7 +232,9 @@ def _vcvars_path(version, vs_install_path): # TODO: This comes from conans/client/tools/win.py vcvars_command() vs_path = vs_install_path or vs_installation_path(version) if not vs_path or not os.path.isdir(vs_path): - raise ConanException("VS non-existing installation: Visual Studio %s" % version) + raise ConanException(f"VS non-existing installation: Visual Studio {version}. " + "If using a non-default toolset from a VS IDE version consider " + "specifying it with the 'tools.microsoft.msbuild:vs_version' conf") if int(version) > 14: vcpath = os.path.join(vs_path, "VC/Auxiliary/Build/vcvarsall.bat") diff --git a/conans/model/conf.py b/conans/model/conf.py index 2c6803a35bf..ec8711e9e5d 100644 --- a/conans/model/conf.py +++ b/conans/model/conf.py @@ -80,7 +80,7 @@ "tools.google.bazel:bazelrc_path": "List of paths to bazelrc files to be used as 'bazel --bazelrc=rcpath1 ... build'", "tools.meson.mesontoolchain:backend": "Any Meson backend: ninja, vs, vs2010, vs2012, vs2013, vs2015, vs2017, vs2019, xcode", "tools.meson.mesontoolchain:extra_machine_files": "List of paths for any additional native/cross file references to be appended to the existing Conan ones", - "tools.microsoft.msbuild:vs_version": "Defines the IDE version when using the new msvc compiler", + "tools.microsoft.msbuild:vs_version": "Defines the IDE version (15, 16, 17) when using the msvc compiler. Necessary if compiler.version specifies a toolset that is not the IDE default", "tools.microsoft.msbuild:max_cpu_count": "Argument for the /m when running msvc to build parallel projects", "tools.microsoft.msbuild:installation_path": "VS install path, to avoid auto-detect via vswhere, like C:/Program Files (x86)/Microsoft Visual Studio/2019/Community. Use empty string to disable", "tools.microsoft.msbuilddeps:exclude_code_analysis": "Suppress MSBuild code analysis for patterns",