asp.net mvc3 intellisense 不会触发 css 类
在 Visual Studio 2010 Ultimate、MVC3、razor 引擎、_Layout.cshtml 中。如果我像这样引用 CSS:
<link href="@Url.Content("/Content/Site.css")" rel="stylesheet" type="text/css" />
那么智能感知不适用于 css 类! 示例:
<div class="<---- IntelliSense don't fire
但是如果我像这样引用 CSS:
<link href="/content/Site.css" rel="Stylesheet" type="text/css" />
则 IntelliSense 工作。
有什么帮助吗?
In Visual Studio 2010 Ultimate, MVC3, razor engine, _Layout.cshtml. If I reference CSS like this :
<link href="@Url.Content("/Content/Site.css")" rel="stylesheet" type="text/css" />
than intellisense don't work for css classes!
example :
<div class="<---- IntelliSense don't fire
But if i reference CSS like this :
<link href="/content/Site.css" rel="Stylesheet" type="text/css" />
than IntelliSense work.
Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,“原因”很简单:Visual Studio 在发现 CSS 文件时不会执行对 Url.Content 的调用。 VS 在计算 JS 表达式时执行 javascript,但不执行发现文件。
您可能想知道如何让它发挥作用......
嗯,到目前为止似乎还没有一个好的方法。不过,我在博客上介绍了其中一个选项(以 JavaScript 为中心):
http://otac0n.com/blog/2011/09/01/getting-javascript-intellisense-in-mvc-razor-views.html
这种技术也应该适用于 CSS。
Well, the "why" is simple: Visual Studio does not execute the call to Url.Content when discovering the CSS files. VS executes javascript when evaluating JS expressions, but not for discovering files.
You are probably wondering how to get it to work...
Well, there doesn't really seem to be a good way, as of yet. However, I cover one of the options (centered around JavaScript) on my blog:
http://otac0n.com/blog/2011/09/01/getting-javascript-intellisense-in-mvc-razor-views.html
This technique should work for CSS as well.