How to make razor the default viewer in an existing project

I upgraded the MVC 2 project to MVC 3. How do I set the default view engine for Razor in an existing project?

Edit: Sorry, I was pretty obscure. I want Razor to be the default type in the Add View dialog box.

+3
source share
3 answers

In the Add View dialog box, the Razor option should be selected by default in the combo box of the viewer if your project has at least one Razor file or if it does not have Aspx files (i.e. a project without view files at all). You do not see this behavior?

+3
source

Short answer:

Change global.asax to use both web forms and razors:

ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine()); ViewEngines.Engines.Add(new WebFormViewEngine()); 
+9
source

There is an MVC3 update tool.

Here you can find the tool and tutorial: http://blogs.msdn.com/b/marcinon/archive/2011/01/13/mvc-3-project-upgrade-tool.aspx

When you create a new view, you can select viewengine, but I do not know how to set the razor, for example, by default.

+1
source

All Articles