Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Complete check for build asp.net mvc core 2.0 application without publish

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?

like image 625
Daniel Santos Avatar asked Feb 27 '18 21:02

Daniel Santos


1 Answers

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" />
like image 75
CodeFuller Avatar answered Oct 16 '22 01:10

CodeFuller