When I list the SDKs installed for dotnet CLI, it only shows 7.x.x...
The current project I'm working on in Visual Studio 2022 targets .Net 6 and it builds fine. When I click on the Target Framework dropdown it shows many more SDK versions.
Since I know my project is building fine targeting .NET 6, how come I only see 7.0.306 with the dotnet cli?
I Googled to see if Visual Studio install it's SDKs in a different location, but didn't find anything specific.
I did find that there's two different downloads of the .NET SDKs from Microsofts's dotnet download site. There's the Download .NET 6 and the Download .NET SDKs for Visual Studio.
But I couldn't find out if they install to different places in the filesystem.
Visual Studio is showing you the list of frameworks available to target.
dotnet --list-sdks
is showing you the list of SDKs you have installed.
That's not the same thing. You can use the .NET 7 SDK to target .NET 6, for example - that's fine. I suspect if you tried to target .NET 7 from VS when you only had the .NET 6 SDK installed, then either VS wouldn't list it, or it would fail to build - but that's slightly different.