.Net Core 2.0 is announced last week and it came up with some awesome features.
I am going to explain its one of the best features which is the compilation of views and pages on Publish.
Till now(before .Net core 2.0) whenever we publish any MVC application, Razor files are published as .cshtml files and they get compiled at runtime.
- It takes a bit more time just to compile all those cshtml files
- Publish output size increases
.Net Core 2.0 has one inbuilt functionality which compiles page and views on publish.
- Our Razor pages and views would get published with our app as a compiled assembly instead of being published as .cshtml source files that get compiled at runtime
So it has advantages as:
- Reduces application startup time
- Reduces Publish output size
So the conclusion is, our .Net Core 2.0 applications are faster than the older applications.
Please note that we can disable this feature if we do not require this.
It can be done by simply updating below property in csproj file:
Have a look here if you require more details.