A tool for precompiling ASP.NET Core MVC Razor views
-
Add to
dependencies
:"dependencies": { + "dotnet-precompile-views": "1.0.0-*" }
-
Add to
tools
:"tools": { + "dotnet-precompile-views": "1.0.0-*" }
-
Add to
scripts
:"scripts": { "postpublish": [ + "dotnet precompile-views -p %publish:OutputPath% -f %publish:FullTargetFramework%", "dotnet publish-iis -p %publish:OutputPath% -f %publish:FullTargetFramework%" ] },
-
Add to
ConfigureServices
:services.AddMvc(); + services.AddPrecompiledViews();
-
Run
dotnet publish
and enjoy a faster startup time!