首页 > 编程语言 >error CS8773: "Feature 'global using directive' is not available in C# 9.0" afte

error CS8773: "Feature 'global using directive' is not available in C# 9.0" afte

时间:2022-09-28 17:45:54浏览次数:88  
标签:available directive level C# after Feature error 9.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>

 

标签:available,directive,level,C#,after,Feature,error,9.0
From: https://www.cnblogs.com/chucklu/p/16738990.html

相关文章