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'}]

Release files for vswhere 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vswhere 1.4.0
File Size Uploaded
vswhere-1.4.0.tar.gz 6.6 kB Details

Release files / vswhere-1.4.0.tar.gz

Download URL vswhere-1.4.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d5680e0ebf83cc6f97204ee75dde4fa83bfe9a95271fd29424bd8728bedf57e3
BLAKE2b-256 checksum
How to use checksums
6417c8d9147f5d424a7574c455721f7f995801f28ef84c09932434b0110d9803
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release history Release notifications | RSS feed

This release

1.4.0 This release

1 release file

1.3.0

2 release files

1.2.0

2 release files

1.1.2

1 release file

1.1.1

3 release files

1.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page