asp.net MVC3智能感知不火的CSS类 [英] asp.net mvc3 intellisense don't fire for css classes
问题描述
在Visual Studio 2010旗舰版,MVC3,剃须刀引擎,_Layout.cshtml。如果我引用CSS是这样的:
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" />
比智能感知没有为CSS类工作!
例如:
than intellisense don't work for css classes! example :
<div class="<---- IntelliSense don't fire
但是,如果我引用CSS是这样的:
But if i reference CSS like this :
<link href="/content/Site.css" rel="Stylesheet" type="text/css" />
比智能感知的工作。
than IntelliSense work.
任何帮助吗?
推荐答案
那么,为什么很简单:发现的CSS文件时,Visual Studio中不执行调用Url.Content。 VS执行的的JavaScript 的评估JS前pressions的时候,而不是发现的文件。
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...
那么,有没有真正似乎是一个很好的方式,为的是尚未。不过,我盖的一个选项在我的博客(约JavaScript的居中):
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
此技术应该对CSS的正常工作。
This technique should work for CSS as well.
这篇关于asp.net MVC3智能感知不火的CSS类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!