ASP.NET MVC C# Language Level - Not working
Answered
Visual Studio 2017 v15.2
R# 2017.1.2
I have an ASP.NET MVC project which builds and runs correctly. R# is consistently telling me that every single view is an error, because it is using a C# 6 language feature.
- I have tried clearing the caches and restarting VS.
- I have tried clearing the caches, closing VS, and deleting the "_ReSharper.Caches" folder.
- I have tried setting the language version in the Properties -> Build -> Advanced dialog.
- I have tried explicitly setting the R# "C# Language Level".
The errors persist.
I do not have time to re-create this project from scratch!
Please tell me I have an option to fix this BUG without disabling R#.
Please sign in to leave a comment.
Hello Richard
Please try setting the compiler version in web.config to a numeric value (/langversion:6) - https://youtrack.jetbrains.com/issue/RSRP-465110.
Thanks!
Also, attempting to report this as a bug from within Visual Studio returns the error "Connection refused". Where's the button to report a bug with the bug reporting feature?!
Updating to R# 2017.1.3 makes no difference.
Downgrading Microsoft.Net.Compilers from 2.2.0 to 1.3.2 seems to have fixed the problem. But why?
I can understand R# not knowing about a newer version of the compiler; but why would explicitly setting the C# language level to 6.0 not actually tell R# to allow C# 6.0 language constructs?
And when will R# be updated to support the newer versions of this package?
Aaargh! That's got it, thanks.
It was already set to 6, but the updated NuGet package reset it to "default" for some reason.