Is it possible to use the Razor v2 View Engine in an MVC3 application? I see there are NuGet packages, but when I install them in my application I still cannot use the new Url Resolution (using href="~/Path/file.css", instead of href="@Url.Content("~/Path/file.css")")
or Automatic Attributes within my views.
Do I need to override something in my web.config? Or am I misunderstanding all of this and it is only available in MVC4? If that is the case, what is the purpose of the Razor NuGet Packages?
When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
Are these two seperate things? Looked at the examples and the syntax looked pretty much the same. Perhaps this one is meant more for populating templates at run time for things like email?
When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Sweeperq
Contributor
2691 Points
585 Posts
Possible to Use Razor v2 in MVC3?
Apr 23, 2012 06:53 PM|LINK
Is it possible to use the Razor v2 View Engine in an MVC3 application? I see there are NuGet packages, but when I install them in my application I still cannot use the new Url Resolution (using href="~/Path/file.css", instead of href="@Url.Content("~/Path/file.css")") or Automatic Attributes within my views.
Do I need to override something in my web.config? Or am I misunderstanding all of this and it is only available in MVC4? If that is the case, what is the purpose of the Razor NuGet Packages?
Mikesdotnett...
All-Star
154867 Points
19862 Posts
Moderator
MVP
Re: Possible to Use Razor v2 in MVC3?
Apr 23, 2012 07:18 PM|LINK
Razor 2 is largely what makes MVC 4. It's not available in MVC 3. What packages are you talking about?
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
Sweeperq
Contributor
2691 Points
585 Posts
Re: Possible to Use Razor v2 in MVC3?
Apr 23, 2012 07:25 PM|LINK
http://nuget.org/packages/RazorEngine
Are these two seperate things? Looked at the examples and the syntax looked pretty much the same. Perhaps this one is meant more for populating templates at run time for things like email?
Mikesdotnett...
All-Star
154867 Points
19862 Posts
Moderator
MVP
Re: Possible to Use Razor v2 in MVC3?
Apr 23, 2012 07:57 PM|LINK
Yep - that's a separate thing. It is intended to allow you to build templates using the Razor syntax, but external to MVC or ASP.NET Web Pages.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
Sweeperq
Contributor
2691 Points
585 Posts
Re: Possible to Use Razor v2 in MVC3?
Apr 23, 2012 08:06 PM|LINK
That clarifies things. Thank you for your help.
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Possible to Use Razor v2 in MVC3?
Apr 28, 2012 07:55 AM|LINK
See, Using Razor V2 in ASP.NET MVC 3
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD