如何在MVC 4使用NHaml? [英] How to use NHaml in MVC 4?

查看:345
本文介绍了如何在MVC 4使用NHaml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用HAML在Ruby on Rails的,我发现了一个HAML版本的.Net叫NHaml,我累了搜索如何在Web应用程序中实现NHaml,我读了这篇文章:http://weblogs.asp.net/stephenwalther/asp-net-mvc-tip-35-use-the-nhaml-view-engine但我不能完成的步骤,因为我有一个错误与此行

I have used haml in Ruby on Rails, and I found a haml version in .Net called NHaml, I am tired to search how to implement NHaml in a web application, I read this article: http://weblogs.asp.net/stephenwalther/asp-net-mvc-tip-35-use-the-nhaml-view-engine but I can't complete the steps because I have an error with this line

ControllerBuilder.Current.SetControllerFactory(new NHamlControllerFactory());

我认为本教程是一个旧版本,我需要使用HTML的MVC 4,我真的不知道,如果这个项目是死的,因为我查到的资料是2011年,2010年,2009年...

I think that the tutorial is for a old version, I need to use Html in MVC 4, really I don't know if the project is dead, because the information that I found is of 2011, 2010, 2009...

推荐答案

删除您有任何旧版本并安装这一个:

Remove any old versions you have and install this one:

https://github.com/NHaml/NHaml

然后,加入这一行:

ViewEngines.Engines.Add(new NHaml.Web.Mvc3.NHamlMvcViewEngine())

这篇关于如何在MVC 4使用NHaml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆