-
Notifications
You must be signed in to change notification settings - Fork 993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Conan 2.0 fails to find Visual Studio Build Tools using the 'MSBuildToolchain' #13281
Comments
Note, in conan 1.x, the recipe used As this is not awailable anymore, I tried to use the MSBuildToolchain and NMakeToolchain, both with the error described above. |
Hi @rainman110 Thanks for reporting this, this is really unexpected, and not sure why it is not working, the underlying code that does the VS detection based on vswhere is the same as in 1.X. Could you please try to define in your profile |
Should this be the path to vcvarsall.bat or where should it point to? |
It should be the base installation path, something like:
|
@memsharded I am a bit puzzled. It does not accept this config variable when defining it in the profile. I need to set it as a config variable.
|
Nevermind, I just had to add it to the Now, the error is gone. I will see, wether it works now. |
Just for future reference, the correct settings needs to be:
|
Do you have installed exclusively the build-tools, but not the full VS IDE? |
Exactly, I only used the "free" buildtools, no IDE is installed. It comes with the compiler, MsBuild, WinSDK etc. |
Is vswhere only called when creating the profile via detect? If so, where is the installation_path actually stored in the profile after creating it? |
@memsharded In fact, vswhere does not list my visual studio build tools installation. I can live for now with the workaround though! |
However, if I pass "*" to the products arguments, it will find the build tools:
|
That is interesting. We indeed have: try:
legacy_products = vswhere(legacy=True)
all_products = vswhere(products=["*"])
products = legacy_products + all_products
except ConanException:
products = None So the product=* is there, maybe the order needs to be reversed? The |
Could you please point to the MSBuild thing to install only the tools? not evident in the msft site. |
Sorry, I could not understand what you want me to do 😅 |
It seems to raise an exception at line
so, all_products is not set . |
A link to download the MSBuildTools-only installer 😄 |
Sure, let me see, whether I still can find it. |
I started debugging the code. It raises an exception at line
which is
Update: The exception comes from the line |
Okay... The problem is the encoding of the vswhere output, which contains letters such as "ö". See output above. |
On windows, the encoding needs to be "ansi" |
If you want, I'll provide a PR, including a potential fix |
The output of vswhere uses "Ansi" encoding. It was though decoded via "Utf-8", which raised an exception in certain cases (i.e. letters like 'ö'). Thus, some visual studio installation could not be found. Fixes conan-io#13281
The output of vswhere uses "Ansi" encoding. It was though decoded via "Utf-8", which raised an exception in certain cases (i.e. letters like 'ö'). Thus, some visual studio installation could not be found. Fixes conan-io#13281
Just to confirm that I have the same problem (french output in my case), Visual Studio detection fails (I have to explicitly set vswhere output:
|
The output of vswhere normally uses "Ansi" encoding. It was though decoded via "Utf-8", which raised an exception in certain cases (i.e. letters like 'ö'). This commit forces the output to be utf-8, by providing the "utf8" option to vswhere. Thus, some visual studio installation could not be found. Fixes conan-io#13281
The output of vswhere normally uses "Ansi" encoding. It was though decoded via "Utf-8", which raised an exception in certain cases (i.e. letters like 'ö'). This commit forces the output to be utf-8, by providing the "utf8" option to vswhere. Thus, some visual studio installation could not be found. Fixes #13281
Closed by #13284, for 2.0.1 |
Environment details
Steps to reproduce
It fails finding the Visual Studio 16 Build Tools installation with an error:
Note: I already tried to manually activate vcvars, but conan still does not find the installation.
Logs
The text was updated successfully, but these errors were encountered: