On my VS.NET 2015 development machine, the Razor views that use the nameof operator work like a charm.
When deploying to a Windows server, it fails to compile the CSHTML
Make sure in your file "web.config" the node system.codedom exists.
system.codedom
And you'd reference the package Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
Microsoft.CodeDom.Providers.DotNetCompilerPlatform