I'm using Visual Studio 2017 with an MVC project targeting the .Net Core 2.0 framework. In a view I'm getting the interpolated strings error along with one for async function.
When I first received it, I changed in Properties -> Build -> Advanced the Language Version from 4.0 to 7.1 compiled with no luck. I also found a couple of other solutions saying to install nuget packages Microsoft.Net.Compilers and another Microsoft.CodeDom.Providers.DotNetCompilerPlatform. After installing both packages, I still have the error in my view.
I did a quick test of the syntax in my controller and it seems to be fine and doesn't throw an error. I thought when you install a new version of VS, you get the most recent version of C#? Do I need to install the C# compiler or something?
This is the code that is causing the problem:
<p class="text-center">
@if (item is Jamboree)
{
((Jamboree)item).EventDate.Date.ToString();
}
else
{
$"{((Shootout)item).EventBegDate.Date} thru {((Shootout)item).EventEndDate.Date.ToString()}";
}
</p>