4

After recently installing Resharper I started getting warnings where it was finding items in style sheets that were not compatible with CSS 3. I was receiving error messages such as:

'xxxx' is not a known CSS property name
Property 'xxxxx' doesn't exist in CSS 3.0

It seems that Visual Studio is set up to use CSS 2.1 validation. I've found a questions on here saying how to turn the validation on, but nothing saying how to set the schema validation version. How can I do so?

Community
  • 1
  • 1
GrandMasterFlush
  • 6,269
  • 19
  • 81
  • 104

1 Answers1

4

There doesn't seem to be a UI for changing the schema version but it can be done manually.

Navigate to:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Packages\schemas\html\ 

There should be a file called html_5.xsd that contains the the setting.

Look for the vs:cssschema element (which should be near the top of the file) and change it from :

vs:cssschema="CSS 2.1"

to

vs:cssschema="CSS 3.0"

After re-starting Visual Studio the CSS schema validation version should change.

GrandMasterFlush
  • 6,269
  • 19
  • 81
  • 104
  • 2
    Still valid to VS2017! – DATEx2 Oct 29 '17 at 15:36
  • Well not really - path in VS2017 (at least in my install) is C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Packages\Schemas\html. My setting is 2.1, but VS is telling me my CSS isn't valid with CSS 4.0. This validation is happening in my .less file; this setting may be only when styles are being defined in HTML. – jessewolfe Sep 14 '20 at 03:04