How to change the language version in Visual Studio 2015

I want to use the nameof operator in my C # project in Visual Studio 2015, but the compiler complains about the following message.

The 'nameof operator' function is not available in C # 5. Please use the language version 6 or more.

I want to know how I can change the C # language version from Visual Studio 2015.

+19
c # visual-studio visual-studio-2015 nameof
Aug 10 '15 at 6:09
source share
4 answers

Try it.

Project → Properties → Assembly → Advanced → Language version

+35
Aug 10 '15 at 6:13
source share

Go to ProjectPropertiesBuildAdvancedLanguage versionOK , as shown using the steps with details and screenshots below:

Follow these steps to change the language version of your project.

1: open the project using Visual Studio 2012, 2013 or 2015, click View from the menu, and then click Solution Explorer

enter image description here

2: from Solution Explorer, right-click the project and Properties from the context menu

enter image description here

3: In the properties dialog box, select the Create tab and click the Advanced button

enter image description here

4: Now from the Advanced Build Settings dialog box, select Language Version and click OK . Here it is.

enter image description here

+45
Aug 10 '15 at 6:12
source share

Hello, I have the same problem: in Visual Studio version 2019, the error tells me that I need a different version of the language, but when I click on the property, the window does not seem so impossible to change the version if, please help me

0
May 15 '19 at 10:21
source share

What about Visual Studio 2017? I get this error: the pattern matching function cannot be used because it is not part of the C # 4.0 language specification. I follow the above steps, but in 2017, this is not the same.

0
May 15 '19 at 14:04
source share



All Articles