Ok. Thank you for the replies.
Seems the verdict is I have to use the latest dotnet sdk with vscode now.
I was a bit confused by dotnet sdk/dotnet framework difference. I think the issue was that I updated an app (having dome some searching it was probably c# dev kit or something related and I think it may have been replaced by .NET Install Tool after update) in vscode which either depends on the dotnet 10 sdk or forces its use and dotnet 10 sdk was not present in my environment.
I installed dotnet 10 sdk and can now run ok from vscode, even when using dotnet framework 7.