Skip to main content

Python vswhere

This module provides an interface to Microsoft's Visual Studio locator tool, vswhere.

If Visual Studio 15.2 or later has been installed, this will use the vswhere binary installed with Visual Studio. Otherwise, it will download the latest release of vswhere the first time a function is called.

Usage

find() and find_first() are the most generic functions. They support most of the command line options to vswhere. find() returns a list of installed copies of Visual Studio matching the given options, and find_first() returns only the first result.

If you are only interested in the latest version of Visual Studio, use get_latest(). To get just the installation path, use get_latest_path(). To get just the version number, use get_latest_version() or get_latest_major_version(). These functions also support the same arguments as find(), so you can find pre-releases or different products such as build tools.

If you want to use your own version of vswhere.exe instead of the one installed with Visual Studio, use set_vswhere_path() to provide its location.

If you want to use a mirror instead of GitHub to download vswhere.exe, for example when on an intranet that does not have access to GitHub, use set_download_mirror() and provide the URL of the mirror.

Examples

>>> import pprint, vswhere
>>> vswhere.get_latest_path()
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community'
>>> vswhere.get_latest_path(products='Microsoft.VisualStudio.Product.BuildTools')
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools'
>>> vswhere.get_latest_version()
'16.5.30011.22'
>>> vswhere.get_latest_major_version()
16
>>> vswhere.find(legacy=True, prop='installationPath')
['C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community', 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\']
>>> pp = pprint.PrettyPrinter(indent=4, width=200)
>>> pp.pprint(vswhere.find(legacy=True))
[   {   'catalog': {   'buildBranch': 'd16.5',
                       'buildVersion': '16.5.30011.22',
                       'id': 'VisualStudio/16.5.4+30011.22',
                       'localBuild': 'build-lab',
                       'manifestName': 'VisualStudio',
                       'manifestType': 'installer',
                       'productDisplayVersion': '16.5.4',
                       'productLine': 'Dev16',
                       'productLineVersion': '2019',
                       'productMilestone': 'RTW',
                       'productMilestoneIsPreRelease': 'False',
                       'productName': 'Visual Studio',
                       'productPatchVersion': '4',
                       'productPreReleaseMilestoneSuffix': '1.0',
                       'productSemanticVersion': '16.5.4+30011.22',
                       'requiredEngineVersion': '2.5.2141.57745'},
        'channelId': 'VisualStudio.16.Release',
        'channelUri': 'https://aka.ms/vs/16/release/channel',
        'description': 'Powerful IDE, free for students, open-source contributors, and individuals',
        'displayName': 'Visual Studio Community 2019',
        'enginePath': 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service',
        'installDate': '2019-06-24T05:30:57Z',
        'installationName': 'VisualStudio/16.5.4+30011.22',
        'installationPath': 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community',
        'installationVersion': '16.5.30011.22',
        'instanceId': '0a09d80d',
        'isComplete': True,
        'isLaunchable': True,
        'isPrerelease': False,
        'isRebootRequired': False,
        'productId': 'Microsoft.VisualStudio.Product.Community',
        'productPath': 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\devenv.exe',
        'properties': {   'campaignId': '1263684068.1543796472',
                          'channelManifestId': 'VisualStudio.16.Release/16.5.4+30011.22',
                          'nickname': '',
                          'setupEngineFilePath': 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vs_installershell.exe'},
        'releaseNotes': 'https://go.microsoft.com/fwlink/?LinkId=660893#16.5.4',
        'state': 4294967295,
        'thirdPartyNotices': 'https://go.microsoft.com/fwlink/?LinkId=660909',
        'updateDate': '2020-05-10T17:04:46.9919584Z'},
    {'installationPath': 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\', 'installationVersion': '14.0', 'instanceId': 'VisualStudio.14.0'}]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vswhere-1.3.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vswhere-1.3.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file vswhere-1.3.0.tar.gz.

File metadata

  • Download URL: vswhere-1.3.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for vswhere-1.3.0.tar.gz
Algorithm Hash digest
SHA256 16f6fd762ff3897355c250c27d8527a00b38aa617cc8254fc61e01c82bdc7cdf
MD5 1bd2b0005b1cb84410ec838319aeaf01
BLAKE2b-256 239fdaee3842627d6807e55fb9f152f663c6da541eba1f2fb592bd893cb73a4c

See more details on using hashes here.

File details

Details for the file vswhere-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: vswhere-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for vswhere-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fefd90039bbaa561f6de929423b55db74d9882f565600d88786f8d64177f9724
MD5 b16dfc2af99beb0d49042544f2c0b33e
BLAKE2b-256 010861c96b59587d1afe437e24d2b48b6871d6fc83c5e9706d500ccae7ca75d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page