Skip to content

Issues with detection of Visual Studio installations #866

Description

@m-kessler

The function visual_studio_installation_paths does not detect VS 2026 and
has issues when the same major Visual Studio version is installed multiple times (like two installations of VS 2022).

Consider this output of vswhere on an exemplary machine with several Visual Studio installations:

> vswhere -products * -property InstallationPath
C:\Program Files (x86)\Microsoft Visual Studio\2019\BT16.9
C:\Program Files\Microsoft Visual Studio\2026\Professional
C:\Program Files (x86)\Microsoft Visual Studio\2022\BT17.10
c:\Program Files\Microsoft Visual Studio\2022\Professional

visual_studio_installation_paths does not handle this correctly:

from fmpy.util import visual_studio_installation_paths
import pprint

pprint.pp(visual_studio_installation_paths())

Gives:

[(17,
  'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BT17.10\r\n'
  'c:\\Program Files\\Microsoft Visual Studio\\2022\\Professional'),
 (16, 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BT16.9')]

We see that:

  • VS 2026 (18) is not detected
  • The paths to both VS 2022 (17) installations are joined into a single string (here printed across two lines, due to pprint)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions