microsoft / vswhere

Locate Visual Studio 2017 and newer installations
MIT License
923 stars 98 forks source link

How do I find Visual Studio by year? #300

Closed idbrii closed 1 year ago

idbrii commented 1 year ago

I use premake which specifies Visual Studio toolchain like this: vs2017.

Is there some kind of query I can use, or do I need to list all versions and search for 2017 in the results?

Versions on the wiki only lists internal product versions (14) instead of name versions (2017).

idbrii commented 1 year ago

Using pyvswhere, I got to this:

def match_year(t, year):
    return t['catalog']['productLineVersion'] == year

print(next(t['productPath'] for t in vswhere.find() if match_year(t, '2017')))

But it would be great if I could use something to easily find the latest for the user-facing name:

print(t['productPath'] for t in vswhere.find_first(productyear=2017))
vswhere.exe -productyear 2017 -latest -property productPath
heaths commented 1 year ago

Marketing (year) versions are not supported, on. There's little value in them over the more descriptive major.minor.build versions encoded into the product information. I added a new section to that page that should help, however.