Skip to content

Commit

Permalink
better ux for VS not found error (conan-io#15250)
Browse files Browse the repository at this point in the history
* better ux

* improve

* Update conan/tools/microsoft/visual.py

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>

---------

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
  • Loading branch information
memsharded and AbrilRBS authored Dec 11, 2023
1 parent 5ef6824 commit 2717bbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion conan/tools/microsoft/visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion conans/model/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2717bbe

Please sign in to comment.