确定Visual Studio 2019 / .NET框架4.8中的C#版本
我有一个运行 .net Framework 4.8 的项目,并且在“构建> Advanced≫语言版本”“ Visual Studio State”下的项目属性中自动选择了基于框架版本”。如果他们向我展示自动选择哪个版本,那不是很棒吗? :o/
根据 https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version-version (其他)我的项目应该使用 c#7.3 ,但我无法使用最新功能。 “最新”为“至关以微软为让我使用旧的.NET框架”。
如何确定正在使用哪个C#版本,以及如何更新到“最新”版本?
I have a project running .NET Framework 4.8 and in the project's properties under "Build > Advanced > Language Version" Visual Studio states "Automatically selected based on framework version". Wouldn't it be great, if they were to show me which version was automatically selected? :o/
According to https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version (amongst others) my project should be using C# 7.3, but I cannot use the latest features. "Latest" as in "as far as Microsoft will let me go with the old .net Framework".
How can I determine which C# version is being used and how can I update to the "latest" version?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道是否可以从Visual Studio中查看当前选择的Lang版本。但是指定最新版本非常容易。
从您链接的同一篇文章中,在文本编辑器中编辑CSPROJ文件,然后添加行
&ltangversion>最新</langversion>
,例如:您还应该能够指定
preview
preview
作为获取预览版本的langversion。请注意,并非所有的.NET平台都支持所有语言版本,因此在.NET框架上使用此语言版本在技术上不受技术支持。但是我一直在.NET 4.8上运行最新版本,到目前为止尚未注意到任何重大问题。最明显的问题是必须手动编辑所有CSPROJ文件。
I have no idea if it is possible to view the currently selected lang version from within visual studio. But it is fairly easy to specify the latest version.
From the same article you linked, edit your csproj file in a text editor and add the line
<LangVersion>latest</LangVersion>
, For example:You should also be able to specify
preview
as the langversion to get the preview version.Note that not all language versions are supported for all .net platforms, so using this on .Net framework might not technically be supported. But I have been running the latest version on .net 4.8 and not noticed any major issues so far. The most noticeable issue is having to manually edit all the csproj files.