Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Saturday, October 3, 2015 9:01 AM
I have a C# (.NET 4.5) class library written before new C# features like "nameof" that I compile with msbuild in .bat file.
If I use "nameof", in Visual Studio the project complile and works fine, but with batch file msbuild give me this error:
error CS0103: The name "nameof" does not exists in the current context
Can anyone help me?
Simone
All replies (3)
Saturday, October 3, 2015 9:45 AM âś…Answered
The nameof operator is a new feature in C# 6 which is the default C# language version in Visual Studio 2015.
Make sure that you are using the correct version of MSBuild. This is the version that ships with Visual Studio 2015:
C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe.
Please refer to the following thread for more information: http://stackoverflow.com/questions/32007871/how-to-upgrade-msbuild-to-c-sharp-6
Hope that helps.
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.
Saturday, October 3, 2015 9:47 AM
nameof() is not a part of the .NET Framework. But of the C# 6.0 langauge definition.
So with wich C# language version is the compiler running?
Wednesday, October 14, 2015 5:30 PM
Sorry for delay... you are right, I was using the wrong msbuild version.
Thanks,
Simone