As written in the .NET 7 release notes for .NET 7 support in Visual Studio you need to install 17.4+ version:
You need Visual Studio 17.4 latest preview to use .NET 7.0 on Windows. On macOS, you need the latest version of Visual Studio for Mac. The C# extension for Visual Studio Code supports .NET 7.0 and C# 11.
You can try using 2019 version but some features even for .NET 6 (see this answer) will not work correctly (note that building and running from command line via dotnet ...
still should work correctly if appropriate SDK is installed).
So in short - install the latest VS 2022.