20

Resharper tells me, "Unknown css class 'container-fluid" for this line in my site's _SiteLayout.cshtml file:

<header class="container-fluid">"

I do have this in my <head> section:

<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">

...and I believe "container-fluid' is there. Is this simply a matter of Resharper not being able to find the class because it's remote?

4

2 回答 2

8

I was also having this issue using Resharper 8.2, tried Fizzix solution but I already had those options selected and it didn't seem to fix it :(

What did work, however, was a simple fix;

  • I right-clicked on the css file that contained the class it was telling me was unknown in my SOlution Explorer.
  • Selected 'Exclude from Project'
  • Right-clicked on file again and 'Include in Project'

Error went away instantly and page now renders with the css class correctly! Weird!

于 2014-07-07T08:39:37.243 回答
3

ReSharper cannot access this file since it is not yet rendered into the project.

For example, when you have a CSS file within your project, ReSharper can simply search through it looking for class names. Although, when a CSS file is outside of your project (remote, or in a CDN), it does not have the capabilities to access it since it is not included yet.

Once your project is running within a browser and the file from the CDN is called, that is when it is included within your project.

Therefore, if you would like to know which class names exist or not when working with ReSharper, it is usually best to download them and include them within your project :)

EDIT:

After researching into this, I think I have found a way to allow ReSharper to search within external sources and uncompiled code.

Go to: ReSharper -> Options -> Tools -> External Sources

enter image description here

More information in the official documentation for ReSharper | Options | Tools | External Sources.

于 2014-05-12T05:10:00.487 回答