I believe I read somewhere there is a setting in one of the project files that will allow you to compile the .cshtml
files when building your Visual Studio project.
Just getting started with MVC/Razor/Query
Mobile, and am getting annoyed with the "Error loading page" when I have an error in a code block inside a .cshtml
file
cshtml extension are compiled at both build and publish time using the Razor SDK. Runtime compilation may be optionally enabled by configuring your project.
Go to solution explorer => Views Folder => Right-click on “Home” Folder >> go to “Add” >> Click on [New Item] as follow. Select MVC 5 View Page with Layout(Razor) from "Add New Item" window and provide the required name like "ViewPageWithLayout. cshtml" click on "Add" button as follow.
Set <MvcBuildViews>true</MvcBuildViews>
in the <PropertyGroup>
element of your .csproj file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With