What differences are there between using the .csproj setting MvcBuildViews and using Razor Generator to achieve the same thing?
My own presumption is that MvcBuildViews does not make intelli-sense of views available to unit tests, but what other differences might there be?
The main take-away of this post is: MvcBuildViews is here to make building of views as part of web application building process. It doesn't generate any output to binaries folder. Views are precompiled during publishing process and precompiling happens only if views are not expected to be modified.
cshtml extension are compiled at both build and publish time using the Razor SDK. Runtime compilation may be optionally enabled by configuring your project.
MVCBuildViews doesn't actually pre-compile your views for deployment. It's compiling the views after building your solution to echo any errors that may be in any of your MVC views before you deploy. This way you can catch compile errors for Views before pushing them to your server to avoid the error page or yellow screen of death at runtime.
The RazorGenerator can be used to pre-compile your views to avoid any compiling warmup times on the first hit of any View on your server. When using the RazorGenerator tool you can deploy the assembly for the application instead of the Views Folder, since all the views will be pre-compiled and contained inside that assembly.
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