I would like to write some console apps using C# 11. I know that it can be only with .NET 7x. If I write
<TargetFramework>netcoreapp7</TargetFramework>
in my .csproj file, I will get NETSDK1045 instead of running. But "file" (type modifier) is useful.
CodePudding user response:
There's no inherent downside to upgrading your Visual Studio (as long as your tools are compatible). Within it you can still develop for older versions.
As mentioned by rbdeenk, you have to upgrade Visual Studio as per this link: https://dotnet.microsoft.com/en-us/download/dotnet/7.0
CodePudding user response:
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.