I'm using Visual Studio 2019 and I have 5 or more areas in my ASP.NET Core MVC application.
When I was about to create a new controller and new razor (.cshtml
file) with dynamic layouts, menus, header and footer, I got the error shown below.
I see a lot of questions that don't have answers.
I just found out the answer by editing the .CSPROJ file and add the following :
<PropertyGroup><TargetFramework>netcoreapp2.1</TargetFramework>
<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompileOnPublish>true</RazorCompileOnPublish></PropertyGroup>
and this one:
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompileOnPublish>true</RazorCompileOnPublish>
</PropertyGroup>