[bug] Wrong path of vcvarsall.bat with VisualStudioBuildTools
Describe the bug
I am working in a docker container with Windows 10. OS Name: Microsoft Windows Server 2022 Datacenter OS Version: 10.0.20348 N/A Build 20348
I am downloading several tools from chocolatey: cmake 3.29.2 python 3.12.3 visualstudio2022buildtools 117.10.2.0 For visualstudio2022buildtools I additionally specify following arguments:
--installPath "C:\Program Files\Microsoft Visual Studio\2022\BuildTools" \
--add Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL \
--add Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64 \
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
--add Microsoft.VisualStudio.Component.VC.ATL \
--add Microsoft.VisualStudio.Component.Windows11SDK.22621 \
--add Microsoft.NetCore.Component.Runtime.8.0 \
--add Microsoft.NetCore.Component.SDK \
I create a python virtual environment and install conan 2.15.1 into it.
My conan profile:
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=static
compiler.runtime_type=Debug
compiler.version=194
os=Windows
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
Profile build:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=static
compiler.runtime_type=Debug
compiler.version=194
os=Windows
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
When I run conan install, I get an error when trying to build boost/1.86.0:
-------- Installing package boost/1.86.0 (4 of 4) --------
boost/1.86.0: Building from source
boost/1.86.0: Package boost/1.86.0:3868cb107d7ee73a0ea6aa930c1efa04c34bdb20
boost/1.86.0: Building your package in C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\b
boost/1.86.0: Calling generate()
boost/1.86.0: Generators folder: C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\b\build-release\conan
boost/1.86.0: Generating aggregated env files
boost/1.86.0: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
boost/1.86.0: Calling build()
boost/1.86.0: WARN: replace_in_file didn't find pattern '/* thread_local */' in 'C:\Users\ContainerAdministrator\.conan2\p\boostcfb011e43f97d\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
boost/1.86.0: WARN: replace_in_file didn't find pattern '/* static __thread */' in 'C:\Users\ContainerAdministrator\.conan2\p\boostcfb011e43f97d\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
boost/1.86.0: WARN: replace_in_file didn't find pattern 'local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;' in 'C:\Users\ContainerAdministrator\.conan2\p\boostcfb011e43f97d\s\src\tools\build\src\tools\gcc.jam' file.
boost/1.86.0: WARN: replace_in_file didn't find pattern 'local no-threading = android beos haiku sgi darwin vxworks ;' in 'C:\Users\ContainerAdministrator\.conan2\p\boostcfb011e43f97d\s\src\tools\build\src\tools\gcc.jam' file.
boost/1.86.0: WARN: Patching user-config.jam
boost/1.86.0: WARN:
using zlib : 1.3.1 : <include>"C:/Users/ContainerAdministrator/.conan2/p/b/zlibc8e77b13bfc52/p/include" <search>"C:/Users/ContainerAdministrator/.conan2/p/b/zlibc8e77b13bfc52/p/lib" <name>zlib ;
using bzip2 : 1.0.8 : <include>"C:/Users/ContainerAdministrator/.conan2/p/b/bzip271c7d8c141c8b/p/include" <search>"C:/Users/ContainerAdministrator/.conan2/p/b/bzip271c7d8c141c8b/p/lib" <name>bz2 ;
using "msvc" : 14.3 : :
;
boost/1.86.0: WARN: b2 -q target-os=windows architecture=x86 address-model=64 binary-format=pe abi=ms --layout=system --user-config=C:\Users\ContainerAdministrator\.conan2\p\boostcfb011e43f97d\s\src\tools\build\user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=off --disable-iconv runtime-link=static runtime-debugging=off threading=multi visibility=hidden link=static variant=release --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=msvc cxxstd=20 pch=on linkflags="" cxxflags="-fPIC" install --prefix=C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\p -j2 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\b\build-release"
boost/1.86.0: RUN: b2 -q target-os=windows architecture=x86 address-model=64 binary-format=pe abi=ms --layout=system --user-config=C:\Users\ContainerAdministrator\.conan2\p\boostcfb011e43f97d\s\src\tools\build\user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=off --disable-iconv runtime-link=static runtime-debugging=off threading=multi visibility=hidden link=static variant=release --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=msvc cxxstd=20 pch=on linkflags="" cxxflags="-fPIC" install --prefix=C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\p -j2 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\b\build-release"
boost/1.86.0: Full command: "C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\b\build-release\conan\conanbuild.bat" && b2 -q target-os=windows architecture=x86 address-model=64 binary-format=pe abi=ms --layout=system --user-config=C:\Users\ContainerAdministrator\.conan2\p\boostcfb011e43f97d\s\src\tools\build\user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=off --disable-iconv runtime-link=static runtime-debugging=off threading=multi visibility=hidden link=static variant=release --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=msvc cxxstd=20 pch=on linkflags="" cxxflags="-fPIC" install --prefix=C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\p -j2 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\b\build-release"
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.4
The system cannot find the path specified.
boost/1.86.0: ERROR:
Package '3868cb107d7ee73a0ea6aa930c1efa04c34bdb20' build failed
boost/1.86.0: WARN: Build folder C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\b\build-release
Traceback (most recent call last):
File "C:\VirtualEnvironmentForConan2\Lib\site-packages\conan\internal\errors.py", line 35, in conanfile_exception_formatter
yield
File "C:\VirtualEnvironmentForConan2\Lib\site-packages\conan\internal\methods.py", line 35, in run_build_method
conanfile.build()
File "C:\Users\ContainerAdministrator\.conan2\p\boostcfb011e43f97d\e\conanfile.py", line 1167, in build
self.run(full_command)
File "C:\VirtualEnvironmentForConan2\Lib\site-packages\conan\internal\model\conan_file.py", line 374, in run
raise ConanException("Error %d while executing" % retcode)
conan.errors.ConanException: Error 1 while executing
My guess is, that it is related to not finding the vcvarsall.bat file. Following two lines from my output above lead to my guess:
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.4
The system cannot find the path specified.
But for sure the issue might also be somewhere else. I am looking forward to your help! And for sure I am open to provide more information as needed 💟 Cheers, Kilian
How to reproduce it
This is my conanfile.py:
import os
from conan import ConanFile
class MyRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps"
def requirements(self):
self.requires("boost/1.86.0")
def layout(self):
self.folders.root = ".."
self.folders.generators = "conan"
self.folders.imports = os.path.join(self.folders.generators, "imports")
- I open the Visual Studio Developer Command Prompt (
C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat) - I activate the virtual environment (for me it's located at
C:\MyVenv\Scripts\Activate.ps1) - I call
conan install:
conan install ./conanfile.py -vtrace --build missing --output-folder=out/build/x64-Release --profile:all="windows.Release64"
Hi @Ukilele
Thanks for your feedback.
The first thing to check would be not activating the Command prompt. Conan is designed to automatically activate the necessary Command prompt for the right version. Because if you open such a Command prompt, but then issue a conan install -s compiler.version=191 to build for a previous compiler version /toolset (with VS 15-2017 for example), then such environment cannot be activated inside an already Command prompt.
So in the same way that it is not necessary to run inside the prompt for regular CMake builds, it shouldn't be necessary for Conan and it can be actually problematic in different scenarios, so I'd recommend dropping that.
Then, it might be possible that this is a Boost issue, or at least a Boost recipe issue.
To understand if this is a Conan client issue, it would be necessary to reproduce with simpler recipes, for example using the conan new cmake_lib -d name=mypkg -d version=0.1 template, and checking if everything works there. If it works, then it might be a recipe issue, so it would be good to check if things works with other ConanCenter recipes such as zlib for example.
The reproduction can be further reduced, without needing a conanfile, something like:
conan install --requires=zlib/1.3.1 --build=zlib/1.3.1 -pr=myprofile
Should be enough
As some extra hint:
-
build_type=Debugshouldn't be necessary/recommended in most cases in the "build" profile. Because that could be running tools in Debug mode, and this is not wanted in most scenarios. It seems that you want Debug only for the "host" profile, but not for "build" one -
self.folders.importsdoesn't exist in Conan 2, you might want to drop it.
Hi @memsharded , thanks for the comprehensive answer! A lot of info that I have to digest.
I tried:
conan install --requires=zlib/1.3.1 --build=zlib/1.3.1 --profile:all=myprofile
And I get following output:
Complete output
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=static
compiler.runtime_type=Release
compiler.version=194
os=Windows
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=static
compiler.runtime_type=Release
compiler.version=194
os=Windows
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
======== Computing dependency graph ========
zlib/1.3.1: Not found in local cache, looking in remotes...
zlib/1.3.1: Checking remote: conancenter
Connecting to remote 'conancenter' anonymously
zlib/1.3.1: Downloaded recipe revision b8bc2603263cf7eccbd6e17e66b0ed76
Graph root
cli
Requirements
zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76 - Downloaded (conancenter)
======== Computing necessary packages ========
zlib/1.3.1: Forced build from source
Requirements
zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76:805d40acaa2400bcd79bfb1b96f313f2713000a5 - Build
======== Installing packages ========
zlib/1.3.1: Sources downloaded from 'conancenter'
zlib/1.3.1: Calling source() in C:\Users\ContainerAdministrator\.conan2\p\zlib204752602052d\s\src
zlib/1.3.1: Unzipping zlib-1.3.1.tar.gz to C:\Users\ContainerAdministrator\.conan2\p\zlib204752602052d\s\src
-------- Installing package zlib/1.3.1 (1 of 1) --------
zlib/1.3.1: Building from source
zlib/1.3.1: Package zlib/1.3.1:805d40acaa2400bcd79bfb1b96f313f2713000a5
zlib/1.3.1: Copying sources to build folder
zlib/1.3.1: Building your package in C:\Users\ContainerAdministrator\.conan2\p\b\zlibed12fd1817622\b
zlib/1.3.1: Calling generate()
zlib/1.3.1: Generators folder: C:\Users\ContainerAdministrator\.conan2\p\b\zlibed12fd1817622\b\build\Release\generators
zlib/1.3.1: CMakeToolchain generated: conan_toolchain.cmake
zlib/1.3.1: CMakeToolchain generated: C:\Users\ContainerAdministrator\.conan2\p\b\zlibed12fd1817622\b\build\Release\generators\CMakePresets.json
zlib/1.3.1: CMakeToolchain generated: C:\Users\ContainerAdministrator\.conan2\p\b\zlibed12fd1817622\b\src\CMakeUserPresets.json
zlib/1.3.1: Generating aggregated env files
zlib/1.3.1: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
zlib/1.3.1: Calling build()
zlib/1.3.1: Apply patch (conan): separate static/shared builds, disable debug suffix
zlib/1.3.1: Running CMake.configure()
zlib/1.3.1: RUN: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/ContainerAdministrator/.conan2/p/b/zlibed12fd1817622/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "C:/Users/ContainerAdministrator/.conan2/p/b/zlibed12fd1817622/b/src"
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.4
The system cannot find the path specified.
-- Using Conan toolchain: C:/Users/ContainerAdministrator/.conan2/p/b/zlibed12fd1817622/b/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: Setting CMAKE_MSVC_RUNTIME_LIBRARY=$<$<CONFIG:Release>:MultiThreaded>
-- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:4 (project):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH. Perhaps the extension is
missing?
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
zlib/1.3.1: ERROR:
Package '805d40acaa2400bcd79bfb1b96f313f2713000a5' build failed
zlib/1.3.1: WARN: Build folder C:\Users\ContainerAdministrator\.conan2\p\b\zlibed12fd1817622\b\build\Release
ERROR: zlib/1.3.1: Error in build() method, line 81
cmake.configure()
ConanException: Error 1 while executing
I guess the line of interest is:
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.4
The system cannot find the path specified.
which then leads to the effect, that the MSVC compiler cl can't be found by cmake. Next to zlib/1.3.1, I also tried zlib/1.2.13 and botan/3.6.1. Both fail.
Looking forward to your feedback :)
Does it work if you set your profile to use compiler.version=192?
(these lines --add Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL \ --add Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64 \ indicate you are explicitly requesting the installation for the older compiler version)
Hi @jcar87 ,
thanks for your response.
I tried several compiler.version:
- 193: same error as with 194
- 192:
ERROR: zlib/1.3.1: Error in generate() method, line 60
tc.generate()
ConanException: VS non-existing installation: Visual Studio 16. If using a non-default toolset from a VS IDE version consider specifying it with the 'tools.microsoft.msbuild:vs_version' conf
Thanks @Ukilele
You'd have to add
[conf]
tools.microsoft.msbuild:vs_version=17
to your profile (it's a way of telling Conan you have Visual Studio 2022 installed but wish to use the 192 compiler)
In case this does work, there's a chance you need to install the correct components in the build tools if you wish to use the 194
@jcar87 I added the conf. And I tested with all four of compiler.version [191, 192, 193, 194]. Every time I get
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.[1, 2, 3, 4 respectively]
The system cannot find the path specified.
And then follows the error, that cl could not be found.
Thanks @Ukilele - let;'s try to troubleshoot this further. I still suspect an incomplete installation of the tools.
Try to locate the "generators" folder of the recipe you're trying to build that is failing with this error. Conan will output like in the log you pasted above:
boost/1.86.0: Generators folder: C:\Users\ContainerAdministrator\.conan2\p\b\boost77f382b873394\b\build-release\conan
inside that folder, there should be a file called conanvcvars.bat , could you paste the contents here? the last line should show which vcvars.bat script is being invoked, and what parameters are being passed.
We need to verify a couple of things:
- that the full path to vcvars.bat (the path passed to
call) actually exists - which parameters are being passed to it
You can then try to launch a fresh prompt (cmd.exe), and paste the contents to attempt the same setup, for example:
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC/Auxiliary/Build/vcvarsall.bat" amd64 -vcvars_ver=14.4
this should output something like:
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.13.2
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
If it doesn't, we need to check what's wrong
Thanks a lot @jcar87 . I was looking for that conanvcvars.bat file but I didn't find it 🤦
The content is:
@echo off
set __VSCMD_ARG_NO_LOGO=1
set VSCMD_SKIP_SENDTELEMETRY=1
echo conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.4
set "VSCMD_START_DIR=%CD%" && call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC/Auxiliary/Build/vcvarsall.bat" amd64 -vcvars_ver=14.4
It looks for the vcvarsall.bat at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC/Auxiliary/Build/. This directory does not exist. The issue is the part Program Files (x86). It should look at Program Files (without x86).
Thanks!
Could you try adding the following conf to the profile:
[conf]
tools.microsoft.msbuild:installation_path=C:/Program Files/Microsoft Visual Studio/2022/BuildTools/
@jcar87 I did, and now it works 🚀 Oh thank you so much :) As a temporary workaround I can totally live with that. But on the long run I'd prefer, if I would not have to add this line to the profile.
Glad to hear it!
Conan queries vswhere.exe to get the path, so it's not hardcoded.
Could you run, in a fresh cmd.exe prompt, the following command:
"%ProgramFiles(x86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe" -products * -format json
and paste its output? It should tell us about all the Visual Studio installations, as well as the installation path (which is the information Conan would use).
Sure, here is the output:
C:\>"%ProgramFiles(x86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe" -products * -format json
[
{
"instanceId": "2c33f8c6",
"installDate": "2025-04-10T22:18:32Z",
"installationName": "VisualStudio/17.13.6+35931.197",
"installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools",
"installationVersion": "17.13.35931.197",
"productId": "Microsoft.VisualStudio.Product.BuildTools",
"productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\LaunchDevCmd.bat",
"state": 4294967295,
"isComplete": true,
"isLaunchable": true,
"isPrerelease": false,
"isRebootRequired": false,
"displayName": "Visual Studio Build Tools 2022",
"description": "The Visual Studio Build Tools allows you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE. There are options to install the Visual C++ compilers and libraries, MFC, ATL, and C++/CLI support.",
"channelId": "VisualStudio.17.Release",
"channelUri": "https://aka.ms/vs/17/release/channel",
"enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
"installedChannelId": "VisualStudio.17.Release",
"installedChannelUri": "https://aka.ms/vs/17/release/channel",
"releaseNotes": "https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.13#17.13.6",
"resolvedInstallationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=661288",
"updateDate": "2025-04-10T22:18:32.2910911Z",
"catalog": {
"buildBranch": "d17.13",
"buildVersion": "17.13.35931.197",
"id": "VisualStudio/17.13.6+35931.197",
"localBuild": "build-lab",
"manifestName": "VisualStudio",
"manifestType": "installer",
"productDisplayVersion": "17.13.6",
"productLine": "Dev17",
"productLineVersion": "2022",
"productMilestone": "RTW",
"productMilestoneIsPreRelease": "False",
"productName": "Visual Studio",
"productPatchVersion": "6",
"productPreReleaseMilestoneSuffix": "1.0",
"productSemanticVersion": "17.13.6+35931.197",
"requiredEngineVersion": "3.13.2069.59209"
},
"properties": {
"campaignId": "",
"channelManifestId": "VisualStudio.17.Release/17.13.6+35931.197",
"includeRecommended": "0",
"nickname": "2",
"setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe"
}
},
{
"instanceId": "3a635dbf",
"installDate": "2025-04-10T22:17:40Z",
"installationName": "VisualStudio/17.13.6+35931.197",
"installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\TestAgent",
"installationVersion": "17.13.35931.197",
"productId": "Microsoft.VisualStudio.Product.TestAgent",
"productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\TestAgent\\Common7\\IDE\\TestAgentConfigUI.exe",
"state": 4294967295,
"isComplete": true,
"isLaunchable": true,
"isPrerelease": false,
"isRebootRequired": false,
"displayName": "Visual Studio Test Agent 2022",
"description": "Supports running automated tests and load tests remotely",
"channelId": "VisualStudio.17.Release",
"channelUri": "https://aka.ms/vs/17/release/channel",
"enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
"installedChannelId": "VisualStudio.17.Release",
"installedChannelUri": "https://aka.ms/vs/17/release/channel",
"releaseNotes": "https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.13#17.13.6",
"resolvedInstallationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\TestAgent",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=661288",
"updateDate": "2025-04-10T22:17:40.8149944Z",
"catalog": {
"buildBranch": "d17.13",
"buildVersion": "17.13.35931.197",
"id": "VisualStudio/17.13.6+35931.197",
"localBuild": "build-lab",
"manifestName": "VisualStudio",
"manifestType": "installer",
"productDisplayVersion": "17.13.6",
"productLine": "Dev17",
"productLineVersion": "2022",
"productMilestone": "RTW",
"productMilestoneIsPreRelease": "False",
"productName": "Visual Studio",
"productPatchVersion": "6",
"productPreReleaseMilestoneSuffix": "1.0",
"productSemanticVersion": "17.13.6+35931.197",
"requiredEngineVersion": "3.13.2069.59209"
},
"properties": {
"campaignId": "",
"channelManifestId": "VisualStudio.17.Release/17.13.6+35931.197",
"includeRecommended": "0",
"nickname": "",
"setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe"
}
},
{
"instanceId": "5e5b85e0",
"installDate": "2025-04-24T07:22:04Z",
"installationName": "VisualStudio/17.13.6+35931.197",
"installationPath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\BuildTools",
"installationVersion": "17.13.35931.197",
"productId": "Microsoft.VisualStudio.Product.BuildTools",
"productPath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\LaunchDevCmd.bat",
"state": 4294967295,
"isComplete": true,
"isLaunchable": true,
"isPrerelease": false,
"isRebootRequired": false,
"displayName": "Visual Studio Build Tools 2022",
"description": "The Visual Studio Build Tools allows you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE. There are options to install the Visual C++ compilers and libraries, MFC, ATL, and C++/CLI support.",
"channelId": "VisualStudio.17.Release",
"channelUri": "https://aka.ms/vs/17/release/channel",
"enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
"installedChannelId": "VisualStudio.17.Release",
"installedChannelUri": "https://aka.ms/vs/17/release/channel",
"releaseNotes": "https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.13#17.13.6",
"resolvedInstallationPath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\BuildTools",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=661288",
"updateDate": "2025-04-24T07:22:04.4432488Z",
"catalog": {
"buildBranch": "d17.13",
"buildVersion": "17.13.35931.197",
"id": "VisualStudio/17.13.6+35931.197",
"localBuild": "build-lab",
"manifestName": "VisualStudio",
"manifestType": "installer",
"productDisplayVersion": "17.13.6",
"productLine": "Dev17",
"productLineVersion": "2022",
"productMilestone": "RTW",
"productMilestoneIsPreRelease": "False",
"productName": "Visual Studio",
"productPatchVersion": "6",
"productPreReleaseMilestoneSuffix": "1.0",
"productSemanticVersion": "17.13.6+35931.197",
"requiredEngineVersion": "3.13.2069.59209"
},
"properties": {
"campaignId": "",
"channelManifestId": "VisualStudio.17.Release/17.13.6+35931.197",
"includeRecommended": "0",
"nickname": "3",
"setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe"
}
}
]
Excellent, thanks so much!
That would be the problem - there are 3 listed installations:
-
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools" -
C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\TestAgent -
C:\\Program Files\\Microsoft Visual Studio\\2022\\BuildTools
Conan is using the installation path of the first one, where the build tools are actually not found. It would be interesting to see what the contents are of that folder.
The first and the third seem to be.. the same, but on different paths - and presumably, only one of them (the third), has the compiler tools you need.
I think on a system where only the third is listed, it would work without issues. If the installation in C:\\Program Files (x86) had the compiler tools you need, it would also work. Otherwise, that's the purpose of the tools.microsoft.msbuild:installation_path, to have the user disambiguate based on their system.
I'm not entirely familiar with the BuildTools installation process, but there is a small chance that there is something wrong with the installations steps that resulted in the split installation
I can confirm that this issue affects us on Conan 1.66 (downloaded from pip) and Build Tools 2022 (direct from Microsoft). We install inside our container into C:\BuildTools with only the Microsoft.VisualStudio.Workload.VCTools and Microsoft.Net.ComponentGroup.4.8.1.DeveloperTools components, but it still installs files under C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\. It seems to be populated with different versions of the launch scripts, MSBuild and other utilities.
The workaround given by @jcar87 (https://github.com/conan-io/conan/issues/18202#issuecomment-2846999903) works well.
Hi @ntw-au
Do you mean the definition of tools.microsoft.msbuild:installation_path conf?
I am not sure that is really a workaround, but the correct and expected solution when there are different VS installations that the default vswhere routine won't be able to identify.
Well, workaround for having an unexpected extra Visual Studio installation at least. I've looked into it and found that, in our case, the additional VS Build Tools has come from the base container, which in our case is mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019. The clue is that it's a slightly older version (17.12.35506.116/17.12.0 vs 17.13.35931.197/17.13.6) and an older install date (2024-11-12T21:19:04Z vs 2025-05-13T02:24:49Z).
This isn't Conan's fault of course, but as a very low priority backlog suggestion, Conan could raise a warning if multiple VS installations are detected, or choose the most recently installed or newest version (with a warning). It would help reduce the level of surprise and minimise the debugging necessary when builds fail unexpectedly.