Why Does Visual Studio Not Resolve My CSS Class Names or JS Method Names?

“Site-Relative Paths are NOT supported by Visual Studio”. So this was the solution to why I was not getting intellisense in my css. I always use site relative paths for my css files so I needed to add this line in to get Visual Studio to find my css files:

<%--To allow Visual Studio to resolve css class names for Intellisense support, css file path references must be absolute     --%>
    <% if (false) {%>
    <link href="../css/global/app.css" rel="stylesheet" />
    <link href="../css/global/base.css" rel="stylesheet" />
    <% } %>

So now with absolute reference to the css files wrapped inside of the if(false) statement, Visual Studio will be able to find the css file which contains the intellisense information however these file references won’t render on the website since they are wrapped in an if statement that never will resolve to true.

This concept can also be applied to js files and intellisene for methods.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s