pistacchio
pistacchio

Reputation: 58893

Migrate to Razor

Is it possible to migrate an existing ASP.NET MVC3 project using the standard (webforms-like) template engine to Razor? How?

Thanks

Upvotes: 1

Views: 153

Answers (1)

Wiktor Zychla
Wiktor Zychla

Reputation: 48240

It should be possible.

Rename your *.aspx to *.cshtml. Firstpay attention to control directives, for example

Inherits="System.Web.Mvc.ViewPage<MvcApplication1.Models.TheModel>

now becomes

@model MvcApplication1.Models.TheModel

Now examine your views carefully and replace all tags to razor-style tags (<% %> -> @)

Note that you don't have to migrate all your views - it's perfectly legal to mix the two view engines in a single MVC application so you can plan your migration over time.

Upvotes: 1

Related Questions