问题描述
我不能为我自己的HTML佣工获得智能。我的 CustomHtmlHelpers.cs
是这样的:
I can't get intellisense for my own html helpers. My CustomHtmlHelpers.cs
looks like this:
using System.Web.Mvc;
using System.Text;
using System.Web;
namespace laget.Web.Helpers
{
public static class CustomHtmlHelpers
{
//MY HELPERS
}
}
在我的web.config:
and in my Web.config:
<pages>
<namespaces>
<add namespace="laget.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>
<add namespace="System.Web.Helpers" />
</namespaces>
</pages>
如果我把&LT; @using laget.Web.Helpers&gt;在我看来
,我得到的智能感知问题固定
If I put <@using laget.Web.Helpers>
in my view, I get the intellisense issue fixed.
如果它不与Web.config中的code够吗?
Should it not be enough with the code in Web.config?
推荐答案
有时它似乎并没有马上工作。尝试关闭.cshtml文件,然后重新打开它。那么,如果还是不行,请尝试重新启动Visual Studio中。另外,还要确保你确实编译你的项目,智能感知不能与非编译的助手工作。
Sometimes it doesn't seem to work right away. Try closing the .cshtml file, and re-opening it. Then if that doesn't work, try restarting Visual Studio. Also make sure you actually compiled your project, intellisense won't work with non-compiled helpers.
这篇关于为什么不是我的HTML辅助有智能感知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!