Blog categories

How to Compile Razor Views on asp.net mvc

Razor views can be compiled just by Visual Studio.

but how?

Here we go :

  When you publishing just set the option to "Precompile during publishing", under "File Publish Options" on the "Settings" tab.

Click "Configure" and then tick "Merge all outputs to a single assembly".

Give it a unique name, generally something like

[ProjectName].Precompiled

And the Important thing that you have to do is :

Uncheck the "Allow this precompiled site to be updatable"  option

Done

your razor views will be compiled too