Search code examples
c#asp.net-mvc-5string-interpolation

Feature 'interpolated strings' is not available in C# 5. Please use language version 6 or greater.


The following line does not compile when I put in a Razor View.

var extPropLookupNameCompania = $"extension_{SettingsHelper.ClientId.Replace("-", "")}_{"Compania"}";

However in the controller the same line works perfectly fine.

Why I cant user string interpolation on the razor views? or Maybe I need to configure something?


Solution

  • If you are experiencing this error in a .NET Framework 4.5.1 project, upgrading to 4.5.2 solves the problem.