简体   繁体   中英

visual studio 2019 version c# probleme

I can not change the version of C # on visual studio 2019

I tried to go to the property to access a window that normally allowed to change the version of C #

Error CS8025 The 'local functions' feature is not available in C # 4. Use version 7.0 or later.

I'm assuming you're using .Net Core. Within the .csproj file for your start-up project (executable, web, web API, whichever it is in your case), add the following:

<PropertyGroup> <LangVersion>latest</LangVersion> </PropertyGroup>

See the docs for more details.

  • Right click on your csproj in the solution explorer.
  • Select properties.
  • Select 'Build' near the top left of the screen.
  • Click 'Advanced' in the main window (scroll down if you can't see it).
  • Change language version to latest minor version.

I was not able to edit the language in the property page. I had to add this to the csproj which was not able to build. in the propertyGroup, right where AsseblyName is for my .netcore 3 project.

<LangVersion>8</LangVersion>

you should probably use the version according to your .net framework version, the table is here:

The compiler determines a default based on these rules:

DEFAULTS
Target          framework   C# language version default
.NET            6.x         C# 10
.NET            5.x         C# 9.0
.NET Core       3.x         C# 8.0
.NET Core       2.x         C# 7.3
.NET Standard   2.1         C# 8.0
.NET Standard   2.0         C# 7.3
.NET Standard   1.x         C# 7.3
.NET Framework  all         C# 7.3

source: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM