简体   繁体   English

如何在 Visual Studio 2019 中使用 C#10

[英]How to use C#10 in Visual Studio 2019

How can I use C# 10 in Visual Studio 2019?如何在 Visual Studio 2019 中使用 C# 10? I have latest update (16.11.6) and when I try to make a new project (need NET Standard 2.0, for compatibility with 4.7.2) and change it to C#10我有最新的更新 (16.11.6),当我尝试创建一个新项目时(需要 NET Standard 2.0,以便与 4.7.2 兼容)并将其更改为 C#10

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <LangVersion>10.0</LangVersion>
  </PropertyGroup>
</Project>

The IDE will show C#10 features a warning (this is for global usings): IDE 将显示 C#10 功能警告(这是针对全局使用的):

"CS8652: The feature 'global using directive' is currently in Preview and unsupported . To use Preview features, use the 'preview' language version." “CS8652:功能‘全局使用指令’目前处于预览版且不受支持。要使用预览功能,请使用‘预览’语言版本。”

When I change the LangVersion to preview, it at least compiles, but my team has a mix of VS2022 and VS 2019 (to be upgraded later), so I am looking for a way to use proper langversion version (I am not comfortable to use preview) that works for all of them.当我将 LangVersion 更改为预览时,它至少可以编译,但是我的团队有 VS2022 和 VS 2019 的混合(稍后升级),所以我正在寻找一种方法来使用正确的 langversion 版本(我不习惯使用预览)适用于所有这些。

According to the documentation C# 10 is only supported on .NET 6. 根据文档, C# 10 仅在 .NET 6 上受支持。

C# 10 is supported only on .NET 6 and newer versions. C# 10 仅在 .NET 6 和更新版本上受支持。

According to the .NET 6 announcement, .NET 6 is only supported in Visual Studio 2022 .根据 .NET 6 公告, .NET 6 仅在 Visual Studio 2022 中受支持 Not in Visual Studio 2019.不在 Visual Studio 2019 中。

.NET 6 is supported with Visual Studio 2022 and Visual Studio 2022 for Mac. Visual Studio 2022 和 Visual Studio 2022 for Mac 支持 .NET 6。 It is not supported with Visual Studio 2019, Visual Studio for Mac 8, or MSBuild 16. If you want to use .NET 6, you will need to upgrade to Visual Studio 2022. .NET 6 is supported with the Visual Studio Code C# extension. Visual Studio 2019、Visual Studio for Mac 8 或 MSBuild 16 不支持它。如果要使用 .NET 6,则需要升级到 Visual Studio 2022。Visual Studio Code C# 扩展支持 .NET 6 .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Visual Studio 2019 上使用 Bootstrap 5 和 Sass - How to use Bootstrap 5 & Sass on Visual Studio 2019 如何使用 Visual Studio Code 从 Visual Studio 2019 构建、调试和运行现有的 C++ 解决方案 (.sln)? - How do I use Visual Studio Code to build, debug and run existing C++ solution (.sln) from Visual Studio 2019? 如何在 Visual Studio 2019 中将 Windows 终端用作 C++ 项目的调试器控制台 - How to use Windows Terminal as Debugger console in Visual Studio 2019 for C++ Project Visual Studio 2019 WSDL 如何使用<any>元素 - Visual Studio 2019 WSDL how to use <any> element 如何使用 Visual Studio 2019 和 C++ 链接 OpenSSL 库? - How to link the OpenSSL library using Visual Studio 2019 and c++? 如何为 C++ Visual Studio 2019 指定应用程序图标? - How to specify an application icon for C++ Visual Studio 2019? 如何使用 Visual Studio 2019 创建 C# COM Object - How to Create a C# COM Object using Visual Studio 2019 如何在 Visual Studio 2019 中更改 C# 版本 - How do I change the C# version in Visual Studio 2019 如何在 Microsoft Visual Studio 2019 中使用 JetbrainsMono 字体 - How to use JetbrainsMono font in Microsoft Visual Studio 2019 无法在 visual studio 2019 中使用诊断工具 - Cannot use diagnostic tools in visual studio 2019
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM