The VB.NET compiler has the /langversion option for this. Also supported by MSBuild. But not by the IDE, that makes it awkward to change it.
Still possible, you have to edit the .vbproj file. Use a text editor, Notepad will do. And copy/paste this snippet, insert it in the 4th line so it is effective for all configurations and platforms:
<PropertyGroup>
<LangVersion>12</LangVersion>
</PropertyGroup>
And double-check that it is effective:
Module Module1
Sub Main()
Dim test As String
Console.WriteLine(NameOf(test))
End Sub
End Module
Output:
error BC36716: Visual Basic 12.0 does not support 'nameof' expressions.
Well, that works, also flagged by IntelliSense with red squiggles. You probably want to create your own project templates so you don't have to do this over and over again. Use File > Export Template.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…