Skip to content
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

vswhere doesn't find "Visual C++ for Python" #134

Closed
efahl opened this issue Feb 21, 2018 · 10 comments
Closed

vswhere doesn't find "Visual C++ for Python" #134

efahl opened this issue Feb 21, 2018 · 10 comments
Labels

Comments

@efahl
Copy link

efahl commented Feb 21, 2018

Attempting to find all cl.exe locations on one of our development machines shows all but the 9.0 installation.

p:/installers/SCons/vswhere.exe -all -legacy -property installationPath
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional
C:\Program Files (x86)\Microsoft Visual Studio 14.0
c:\Program Files (x86)\Microsoft Visual Studio 10.0\

Here's what cygwin find shows me:

find c:/ -iname cl.exe
c:/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/bin/amd64/cl.exe
c:/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/bin/cl.exe
c:/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/bin/x86_amd64/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX64/x64/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX64/x86/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x86/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x64/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/x86_amd64/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64_arm/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64_x86/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_arm/cl.exe

@heaths
Copy link
Member

heaths commented Feb 21, 2018

vswhere finds installation roots. From there you have to construct the path or do a recursive search. It does not scan the hard drive or search %PATH%. It's not intended to. The README and the wiki have more information.

@heaths heaths closed this as completed Feb 21, 2018
@heaths heaths added the invalid label Feb 21, 2018
@bdbaddog
Copy link

bdbaddog commented Feb 21, 2018

The VC for Python can be found in the registry.

    (HKEY_CURRENT_USER, r'Microsoft\DevDiv\VCForPython\9.0\installdir',),

Can vswhere be updated to check that path as well?

@heaths
Copy link
Member

heaths commented Feb 21, 2018

That is outside the scope of vswhere. Our wiki contains more information, including a newly release FAQ and an example for finding VC as also recommended by the VC team. Registry lookups are not supported since they can only point to a single instance.

@bdbaddog
Copy link

Your code does use registry lookups to find legacy installs currently...
Or am I mistaken?

https://github.com/Microsoft/vswhere/blob/develop/src/vswhere.lib/LegacyProvider.h#L17

And the list of searched legacy versions:

https://github.com/Microsoft/vswhere/blob/develop/src/vswhere.lib/InstanceSelector.cpp#L125

Looks like it's hardcoded to only look for legacy versions 10.0, 11.0, 12.0, 14.0

Can you point to a scope statement which specifies which versions of visual studio (legacy) are meant to be supported?

@efahl
Copy link
Author

efahl commented Feb 21, 2018

Ok, I'm still a bit tentative here, so correct my assumptions:

  1. vswhere is only ever going to locate packages that are "proper" VS installations, i.e., those that contain devenv.exe somewhere.

  2. Since "Visual C++ for Python" is sort of a hacked up partial installation, vswhere will never be able to detect it, and we'll have to fall back to some other method instead (as Bill suggests, just poke the registry).

@heaths
Copy link
Member

heaths commented Feb 21, 2018

@efahl, no, vswhere locations installation paths (roots) of Visual Studio (by default) or related SKUs (if you use -products as documented in the usage and wiki). You can dictate what workloads and/or components you require of an instance for it to be returned. It does not locate those components (components often have many EXEs, or none at all but are an aggregation). From the installation root, most EXE paths are in a fixed path. MSBuild and VC tool chains are an exception, and our wiki has examples of how to find them.

@bdbaddog registry is only supported for legacy detection. We do not support it for Visual Studio 2017. The fact that I implemented it and the lines of code you referenced exist are proof it's supported but, as with the point of vswhere described above, only finds the root installation path.

@bdbaddog
Copy link

@heaths Sure. the 9.0 for python is a legacy. SCons (scons.org) supports back to Visual Studio 6.0 currently. I was just hoping we could use vswhere to support all versions of Visual Studio we support and drop our registry inspection code all together. Providing partial information on older versions would be of use for your user community.. Would a pull request be accepted?

@heaths
Copy link
Member

heaths commented Feb 21, 2018

Finding specific tool locations is outside the scope of vswhere. As previously state, it is for finding the root installation path only.

@bdbaddog
Copy link

Yes. I'm talking about a patch to find root install path of older versions of visual studio (older than 2010)

@heaths
Copy link
Member

heaths commented Feb 22, 2018

At the time legacy support was added, versions older than Visual Studio 2010 are not supported and we made a decision not to support them in vswhere. You will need to continue using legacy registry detection for older, unsupported versions of Visual Studio,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants