4

I have an external stylesheet that has specific IE-hacks. Every so often my site will fail to build due to these hacks (it is the hash-hack; for example #margin-top:-2px;). This is the error:

Unexpected character sequence. Expected a property name for the " : " declaration

I haven't found out a concrete way to get the errors to stop, VS2008 just seems to stop caring after a while. I found this article, but I am unsure of how to edit the files properly so this "error" (since it is legal syntax) will not pop up again.

P.S.
  • 15,970
  • 14
  • 62
  • 86
Anders
  • 12,088
  • 34
  • 98
  • 146

3 Answers3

10

I'm not sure about 2008, but in 2005 (IIRC), you can go to:

 Tools | Options | Text Editor | CSS | CSS Specific 

and then untick Detect Errors

I remember having exactly the same problem on 100% valid CSS which MS didn't recognise (big shock), flicked this switch and forgot about the problem forever more.

annakata
  • 74,572
  • 17
  • 113
  • 180
2

Tools | Options | Text Editor | HTML | Validation

Make sure 'Show Errors' 'As Warnings' is checked. There was a bug early on that even if it was checked, it wasn't acknowledged, in which case, uncheck it and save the settings, then go back and check it again.

John Sheehan
  • 77,456
  • 30
  • 160
  • 194
1

The easiest thing is to close the file in the editor and it should stop complaining.

StingyJack
  • 19,041
  • 10
  • 63
  • 122
  • Man I hate Visual Studio sometimes...Maybe we can find a more "automated" way of preventing this error? – Anders Dec 01 '08 at 15:29
  • I get it with the web.config all day long. http://stackoverflow.com/questions/179927/how-to-resolve-could-not-find-schema-information-for-the-elementattribute-xxx – StingyJack Dec 01 '08 at 20:55
  • +1. Exactly: just close the file with the offending lines CSS / JS lines and all of a sudden the errors are gone (and occasionally a real error may become apparent in the list, which actually prevented the compile cycle to succeed). – Abel Apr 04 '10 at 13:11