error CS8773: "Feature 'global using directive' is not available in C# 9.0" after downgrade from net6.0 to net5.0
error CS8773: "Feature 'global using directive' is not available in C# 9.0" after downgrade from net6.0 to net5.0
回答1
remove <ImplicitUsings>enable</ImplicitUsings>
in the csproj project file, then can build success
find this solution from here
回答2
Remove the tag indeed work.
But just change the value of it did the trick as well!
<ImplicitUsings>disable</ImplicitUsings>
Feature 'top-level statements' is not available in C# 7.3. Please use language version 9.0 or greater. Godot Question
回答
I am not entirely sure if that's the snippet of code which produces the top-level statement error. Top-level statement errors usually come from, typically Program.cs
, or the code file that contains the Main
method.
Top-level statements were introduced with C# 9: MSDN - Top-level statements
In order to enable C# 9.0 in your project, you need to edit your .csproj
file and add the following:
<PropertyGroup>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
Alternatively, you can use the following configuration to target the latest C# version, currently 10.0:
<PropertyGroup>
<LangVersion>latest</LangVersion>
</PropertyGroup>
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2018-09-28 通过powershell操作eventlog
2017-09-28 SwitchyOmega
2017-09-28 What's the difference between Unicode and UTF-8?
2015-09-28 让Outlook一直保持开启