Skip to content

Should MSBuildLocator.RegisterDefaults register the highest VS version instead of first? #81

Open
@jasonmalinowski

Description

@jasonmalinowski

Right now MSBuildLocator.RegisterDefaults registers the first instance it finds on the machine, whatever that is:

var instance = GetInstances(VisualStudioInstanceQueryOptions.Default).FirstOrDefault();

This provides to be wrong in a lot of cases: for example, any tool using RegisterDefaults won't be able to analyze the Roslyn solution on a machine with both VS2017 and VS2019. RegisterDefaults will pick the 2017 version, which will break because we're using the new "GetPathsOfAllDirectoriesAbove" feature which doesn't exist in 2017. Just yesterday both I and @sharwell were independently replacing this in two separate tools with the exact same PR:

dotnet/roslyn#40886
dotnet/roslyn@43e13de

Should this just be the automatic behavior? Because .editorconfig support uses this new MSBuild feature, anybody using any tool using the default function that has both VS2017 and VS2019 on their machine is going to get potentially very unexpected results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions