Saturday, March 10, 2018

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

Leave a Comment

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?

1 Answers

Answers 1

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 Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment