VS 2008 Support to Treat HTML, CSS and JScript Validation issues as warnings instead of errors

One of the features that VS 2005 added was support for HTML source validation.  This enabled you to validate your page markup against different HTML schemas and standards (XHTML Transitional/Strict, HTML 4.01, various browser types, etc).  You could also use the HTML validation features to detect missing link, image or style references in your markup.

For example, if you have an HTML hyperlink in your page that points to a local file that doesn't exist, or if your markup uses (or misuses) HTML or CSS content, you'll by default see red squiggles in the source editor:

 

And if the html document is open you'll by default see these issues listed in the error list:

 

Note: if you don't want HTML validation support at all you can optionally turn off the html validation feature.

Treating HTML, CSS and JScript Validation Issues as Warnings Instead of Errors

One of the common requests with VS 2005 has been to not have these html markup issues added to the error list, but instead have them listed in the warnings list (which you can toggle to hide/show).  This way you can have your error list only contain VB/C# code-related issues, and not be cluttered with a lot of markup problems.

Mikhail Arkhipov from the Visual Studio Web Tools team recently posted about how support for this was just checked-in to a post Beta2 build of VS 2008.  Specifically, you can now bring up the Tools-Options dialog and configure HTML, CSS and JavaScript issues to be treated as warnings instead of errors (I believe this is also now the default out of the box):

This should make it easier (and cleaner) when working on large markup files.

Hope this helps,

Scott

23 Comments

  • Nice stuff.
    I also wish the Visual Studio error/warning list had a built-in view filter like Eclipse does. In Eclipse it's very nice to be able to filter the list of errors/warnings based on the currently selected project or editor. It helps deal with scalability issues when a project contains a very large number of warnings.

  • Will this be available from the webdeployment builds too?

  • Ahh thanks. I've been annoyed with all the CSS errors I get, when a page uses a theme, and then cant see the stylesheet.

  • Another great feature for VS 2008, but on the otherside of the coin ... shouldn't your markup be good enough so that it doesn't have any errors ;-)

    Keep up the great work Scott :-)

  • Great job VS team.
    and we all waiting for more.

  • Yeah, finnally we can get rid of the html/aspx errors without having to close all .aspx files (that usually works too, only c# errors will be displayed then).

  • Nice feature, but when will the next public CTP of VS2008 be available? :-)

  • Nice feature, especially handy when dealing with non XHTML based .aspx files (I mean those with upper case markup).

  • Now that is using your noddle. Great news.

  • I like the fact that X/HTML validation problems can now be set to warnings, but I personally I would prefer the errors out of the box. In today's market letting validation errors slide is a much larger problem than it was a few years ago. There is little excuse for nonstandard and therefore inaccessible markup. If there are so many validation errors on a page that a developer can not distinguish between C#/VB errors and X/HTML errors there's a much larger problem with their page. I digress, however as someone working on a legacy application would benefit from toggling the errors to a warning. At any rate my two cents.

  • I hope a beta 3 is around the corner....
    B2 has some nasty html edit problems, I have not had time yet to try and file bugs on them...

    1) IDE "animates" html -- the design view in some cases goes into a loop of twitching when some element seems to be dynamicaly modified.

    2) if you have the app open local file system and you tri to edit the markup while the local web server is runninmg with debug on
    WHATCH OUT!
    the editor can trash your html ! for example the start of a tag will go missing... the local http still runs but then later you see the html in the browser looks wrong .... then you look at the source and find broken html / aspx tags to fix...

    3) droping controls, adding ajax extenders and setting properties with the flyout can "White Screen" VS 2008 B2 and you have to start over ....

    that's the top 3 bugs I see...

  • Nice one. Good to see you're putting the polish on this thing. Makes me think you must have all the big issues sorted pretty well.

  • Thanks for this one!

  • Thank GOD!!! Putting those in the warning list is better, but not the best way. It would be much better if it would have its own filter. So we would have errors, warnings, messages, and ui validation or something like that. Sometimes I get warnings about some code issue (an unused variable for example) and if those get mixed in with ui validation warnings I may not notice them.

  • Hi Andrew,

    >>>>>>> I like the fact that X/HTML validation problems can now be set to warnings, but I personally I would prefer the errors out of the box. In today's market letting validation errors slide is a much larger problem than it was a few years ago. There is little excuse for nonstandard and therefore inaccessible markup. If there are so many validation errors on a page that a developer can not distinguish between C#/VB errors and X/HTML errors there's a much larger problem with their page. I digress, however as someone working on a legacy application would benefit from toggling the errors to a warning. At any rate my two cents.

    The good news is that you can control whether they get treated as errors or as warnings - so depending on your preference you can have it either way.

    Hope this helps,

    Scott

  • Thats great. I always disliked dealing with markup issues as errors, since they don't affect code compilation.

  • This is actually a very good thing.

    At times, people might use Global masterpages, Inherited master pages, global themes etc. (global images as well) and the reference to them might cause errors. They're really not errors, it's just that the IDE can't find what you're putting in so it flags it as such.

    Great news!

  • Oh happy days! No longer will I have to put up with required CSS hacks showing as errors! :)

  • ys this is a really very very useful feature

  • Hey Scott,
    Is there a way to stop the "Error consol" from popping up every time you make a change and save (if there's a warning/error alreadY)?

    A lot of times in 2005 I might have an error on a page I don't want to fix "right now", however whenever I save the error consol "pops up". I've since pulled a tantrum at work to get a 3rd monitor to throw all windows on so it doesn't interfear with my code window, but it's still annoying when I take my lappy home.

    Does 2008 fix this, or allow you to change it in any way?

  • I've been thinking about this since I read it yesterday. I like this feature, but I'll echo what other people have said and say that maybe it would be better if HTML errors were in their own list.

    Second, after thinking about this wouldn't it be better if this was a project setting and not a IDE setting. I work on a lot of different projects and they are all different. On some of them HTML errors are just not as important, but while on others it is very important. A project setting could be shared with other project members. Or maybe only 1 person needs to worry about HTML errors while other people worry about other aspects.

  • "If the page is XHTML, then the IDE should automatically put the quotes around the attribute values."
    Totally agree. This applies to all html elements. The quotes should be added automatically if the page is xhtml.

  • my VS2008 Beta 2 does not shows the last two options under Text Editor-HTML-Validation

Comments have been disabled for this content.