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
  • 57,247
  • 24
  • 95
  • 149
Pearl
  • 5,485
  • 6
  • 36
  • 55

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
  • 987
  • 9
  • 17