Search code examples
c#asp.net-coreasp.net-core-3.0asp.net-core-3.1

the type or namespace name 'RuntimeCompilation' does not exist in the namespace 'Microsoft.AspNetCore.Mvc.Razor'


If I write this line of code, services.AddMvc().AddRazorRuntimeCompilation(), in startup.cs and while publishing the project from Visual Studio 2019 on Azure, I encounter this error:

The type or namespace name 'RuntimeCompilation' does not exist in the namespace 'Microsoft.AspNetCore.Mvc.Razor'

I've applied ASP.NET Core 3.1.

How can I solve this problem?


Solution

  • As it says in the docs

    Install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package.