0

It seems like Razor doesn't understand the ValueTuple. In my Razor page:

@{
     var x = (1, "a");
}

The code above gives me:

An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.

enter image description here

I tried the same code in my controller and it's working, I already added the following in my csproj:

<PackageReference Include="System.ValueTuple" Version="4.3.0" />

UPDATE

I added this but still not working:

<PackageReference Include="Microsoft.Net.Compilers" Version="2.1.0" />
Erik Philips
  • 51,408
  • 11
  • 123
  • 146
dpp
  • 27,256
  • 30
  • 100
  • 152

1 Answers1

1

Not only do you need to add a newer Compilers package, you also need to configure Razor options.

See previous answer: Using C# 7 features inside of a View in an ASP.NET MVC Core project

Julien Couvreur
  • 4,048
  • 1
  • 28
  • 38