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
  • 53,428
  • 11
  • 128
  • 150
kazinix
  • 28,987
  • 33
  • 107
  • 157

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,473
  • 1
  • 30
  • 40