3

PROBLEM:

I have a master page where the CSS is embdeded, and I am trying to access the CSS classes through the VS2012 intellisense on my partial views.

RESEARCH & SOLUTIONS:

I have spent many hours now trying to resolve this issue and have noted a number of other stackoverflow posts regarding this issue:

Viewing CSS Intellisense in partial views and Content pages - Visual Studio 2010?

http://weblogs.asp.net/jeffwids/archive/2009/06/07/why-does-visual-studio-not-resolve-my-css-class-names.aspx

Why does Visual Studio not resolve my CSS class names?

http://derekreynolds.wordpress.com/2012/11/30/why-does-visual-studio-not-resolve-my-css-class-names-or-js-method-names/

someone has also posted a video showing the EXACT issue I'm having: http://www.youtube.com/watch?v=1bp1TxswSHQ

The solutions provided are to use relative path with the @if (false) {... trick on the partial view page:

@if (false) {
    <link type="text/css" rel="Stylesheet" href="../../content/css/styles.css"/>
}

OR, to use the following on the partial view:

<link rel="stylesheet" runat="server" media="screen" href="~/content/css/styles.css" />

None of these seem to work for me.

I am using VS 2012 Express.

Any ideas?

Community
  • 1
  • 1
Tim Ricker
  • 480
  • 5
  • 10
  • i know there is a resolution for javascript intellisense that uses the _references.js file in the Scripts folder i am also currently on the hunt for a solution for this i will post an answer if i find a suitable solution for this – Chris McGrath Feb 14 '13 at 11:21
  • @ChrisMcGrath thanks Chris - yes, I have been able to get javascript intellisense working, just not the CSS Class intellense. Please do keep me posted. I haven't been able to find a solution yet either. – Tim Ricker Feb 15 '13 at 02:44
  • Hi, Did you ever solve your CSS intellisense problem as I'm having exactly the same problem - see http://stackoverflow.com/questions/15987476/css-intellisense-not-working-for-mvc-4-project-in-visual-studio-2012-ultimate – cyberbobcat May 03 '13 at 14:43
  • Did u find anything. I too have the very same problem http://stackoverflow.com/q/18060913/ – shashwat Aug 06 '13 at 18:03

1 Answers1

2

It seems that css intellisense in .cshtml files is not supported in VS 2012.

http://connect.microsoft.com/VisualStudio/feedback/details/790808/no-intellisense-in-html-editor-to-show-the-classes-in-my-css-file

I tried in VS 2013 RC and it worked as expected.