When I publish a ASP.NET Core MVC 2.0 Project, the Visual Studio does a complete check fore every view (.cshtml file) for variable name consistency. This is perfect for catching small errors that slip by.
How can I do this check without publishing the application, for instance during compile/build time?
All you need is to enable Razor views precompilation during the Build. By default Razor views are compiled only during Publish.
Add PrecompileRazorViews
target to your csproj file:
<Target Name="PrecompileRazorViews"
AfterTargets="Build"
DependsOnTargets="MvcRazorPrecompile" />
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