[英]Can C# 11 be installed in Visual Studio 2019 or should I download VS 2022?
I would like to write some console apps using C# 11. I know that it can be only with .NET 7x.我想使用 C# 11 编写一些控制台应用程序。我知道它只能与 .NET 7x 一起使用。 If I write
如果我写
<TargetFramework>netcoreapp7</TargetFramework>
in my.csproj file, I will get.NETSDK1045 instead of running.在 my.csproj 文件中,我将获取 .NETSDK1045 而不是运行。 But "file" (type modifier) is useful.
但是“文件”(类型修饰符)很有用。
There's no inherent downside to upgrading your Visual Studio (as long as your tools are compatible).升级您的 Visual Studio 没有固有的缺点(只要您的工具兼容)。 Within it you can still develop for older versions.
在其中您仍然可以为旧版本开发。
As mentioned by rbdeenk, you have to upgrade Visual Studio as per this link: https://do.net.microsoft.com/en-us/download/do.net/7.0正如 rbdeenk 所提到的,您必须按照此链接升级 Visual Studio: https://do.net.microsoft.com/en-us/download/do.net/7.0
As written in the .NET 7 release notes for .NET 7 support in Visual Studio you need to install 17.4+ version:如.NET 7 发行说明中所述,Visual Studio 支持 .NET 7,您需要安装 17.4+ 版本:
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.
您需要 Visual Studio 17.4 最新预览版才能在 Windows 上使用 .NET 7.0。在 macOS 上,您需要最新版本的 Visual Studio for Mac。 The C# extension for Visual Studio Code supports .NET 7.0 and C# 11.
Visual Studio Code 的 C# 扩展支持 .NET 7.0 和 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 do.net...
still should work correctly if appropriate SDK is installed).您可以尝试使用 2019 版本,但有些功能甚至适用于 .NET 6(请参阅此答案)将无法正常工作(请注意,通过
do.net...
如果安装了适当的 SDK,仍然应该可以正常工作)。
So in short - install the latest VS 2022.简而言之 - 安装最新的 VS 2022。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.