Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing View Engine after Project has been created

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?

like image 310
Pearl Avatar asked Jan 14 '23 09:01

Pearl


1 Answers

Should be as simple as

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

Add it to Application_Start in global.asax.

like image 152
Hanno Avatar answered Feb 04 '23 00:02

Hanno