4

I have created a project in asp.net mvc4 and set its View Engine to ASPX. Now, I want to change the View Engine to Razor. How to do that? I don't want to create a new project. I want to use existing project to change the View Engine. Can we change the View Engine from Properties or some how?

tereško
  • 58,060
  • 25
  • 98
  • 150
Pearl
  • 8,373
  • 8
  • 40
  • 59

1 Answers1

9

Should be as simple as

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());

Add it to Application_Start in global.asax.

Hanno
  • 1,017
  • 11
  • 18