Double-clicking a .sln file always opens in VS2019, even though the version is set to 17.x

Viewed 169

I have both VS2019 and VS2022 installed on my machine, and have recently been switching to using the latter for all development.

However, I have noticed that double-clicking a .sln file will always open it in VS2019, even if the file was saved from VS2022. This even happens if the solution was created in VS2022.

This answer, backed up by the Microsoft docs suggests that this should not happen.

For example, here is one solution file...

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyProject", "MyProject\MyProject.csproj", "{75AE5AA2-EEF8-4E98-89D6-49C5D473ACEE}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {75AE5AA2-EEF8-4E98-89D6-49C5D473ACEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {75AE5AA2-EEF8-4E98-89D6-49C5D473ACEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {75AE5AA2-EEF8-4E98-89D6-49C5D473ACEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {75AE5AA2-EEF8-4E98-89D6-49C5D473ACEE}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {7837DB11-2301-444C-AEE9-FFE4FED0240B}
    EndGlobalSection
EndGlobal

As you can see, the VS version is set to 17.x, so should open in VS2022, not VS2019 (which is version 16.11.1 on my PC).

I tried setting the MinimumVisualStudioVersion to be 17.0.0, but all that did was open it in VS2019 and throw up an error saying the solution needed a newer version of VS! Not very helpful.

Anyone any idea why these .sln files open in VS2019 instead of VS2022? Thanks

1 Answers

I was running into this same issue and noticed that the file is associated with Visual Studio 2019 instead of Visual Studio Version Selector. I changed the "Open With" association to Visual Studio Version Selector, and these now open for me with VS 2022.

Related