asp.net mvc3 intellisense don't fire for css classes

怎甘沉沦 提交于 2019-12-08 03:04:21

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/7767700/asp-net-mvc3-intellisense-dont-fire-for-css-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!