Asp.net mvc3 intellisense not starting for css classes

In Visual Studio 2010 Ultimate, MVC3, Razor Engine, _Layout.cshtml. If I link to CSS like this:

<link href="@Url.Content("/Content/Site.css")" rel="stylesheet" type="text/css" />

      

than intellisense doesn't work for css classes! Example:

<div class="<---- IntelliSense don't fire

      

But if I reference the CSS like this:

<link href="/content/Site.css" rel="Stylesheet" type="text/css" />

      

than IntelliSense work.

Any help?

+2


source to share


1 answer


Well, the "why" is simple: Visual Studio doesn't call Url.Content when it encounters CSS files. VS executes javascript when evaluating JS expressions, but not for file detection.

You might be wondering how to make it work ...

Well, it doesn't seem to be doing very well at the moment. However, in my blog, I describe one of the options (in the middle of JavaScript):



http://otac0n.com/blog/2011/09/01/getting-javascript-intellisense-in-mvc-razor-views.html

This method should work for CSS as well.

+2


source







All Articles