'IMvcBuilder doesn't contain a definition for it Fro AddRazorRuntimeCompilation

I am using MVC Core and I am trying to add AddRazorRuntimeCompilation(); but it reports that IMvcBuilder doesn't contain a definition for it.

Am I missing something?



Solution 1:[1]

The AddRazorRuntimeCompilation();extension method is in the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation nuget package. Make sure you have this included in your project.

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

Install-Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation -Version 6.0.4

Read this to know more.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Qing Guo