asp-page not working with RazorPages in .NET Core

asp-page not working with RazorPages in .NET Core

I had a problem where my Razor Pages were rendering the "asp-page" Helper to the output HTML. It was happening with pages in an Area. It turns out that you need to copy _ViewImports.cshtml from the Pages folder to the root Area folder.

Michael Earls

Michael Earls

Montgomery, AL, USA
Michael has been a computer nerd since he was ten years old and he begged his parents to buy him a computer for Christmas. In 1982, he was the proud owner of a TI-99/4A. He's been coding since.