I am giving:
a try. The quick start guide mentions to switch the build action to ‘None’. However, this means that the views are not published. Is the build action ‘Content’ correct as this allows publishing?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The purpose behind Razor Generator is that it pre-compiles your razor views, translating the markup in your cshtml files into C# code that gets executed when the view is rendered.
This can happen at design time, when you save a view, if you set the custom tool property for that view to RazorGenerator. Alternatively, it can happen at build time by integrating the Razor Generator MSBuild target.
As you mentioned, without Razor Generator you normally set the build action for your views to “Content”. The markup is parsed at runtime, when the view is first requested, and a compiled view is made available in a dynamically generated assembly. If you use Razor Generator, there is no need to copy the markup around because the compiled views are already part of your web assembly. This is why you can set the build action to “None” on your views.
Other Details:
Razor Generator extends ASP.NET MVC by adding its own
PrecompiledMvcEngineto the collection ofViewEngines. This is used to locate the compiled views as they’re requested.There are some properties of the
PrecompiledMvcEnginethat, if set, will have the engine check if the view exists on disk and use it if it is newer than the pre-compiled view it has in the assembly. This can be useful at design time, so that you can see changes made to your views without rebuilding everything.