How do I verify if views are really rendered from the generated code?

Jun 13, 2013 at 4:08 PM

I have configured RazorGenerator.msbuild and made sure all the views are compiled into the main dll of my mvc project, then published everything to IIS, hit the home page for the first time, I still see a "Find" view entry (1.5 seconds) in the mini profiler.

Also tried deleting one of the cshtml file on the server, I expected the view should be now rendered from generated code, but got a view render error..

Jun 13, 2013 at 4:28 PM
Do you have RazorGenerator.Mvc installed - that's the one that registers the view engine. The way I typically verify if the precompiled view is being used is by printing out the type's assembly - @GetType().Assembly.Name (or .Location). Precompiled views would have the same assembly name as the controller while regular views have auto-generated names.
Jun 13, 2013 at 7:42 PM
Thanks!! Right, I also realized the custom view engine is needed. I don't use NuGet in my project (due to the work environment issues) and the package was installed manually, so I missed the view engine code. Also checking the assembly name is a great idea.