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

Published Tuesday, September 18, 2007 10:56 PM by ScottGu
Filed under: , ,

Comments

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

Wednesday, September 19, 2007 3:01 AM by Jeff Brown

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.

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

Wednesday, September 19, 2007 4:00 AM by Dennis

Will this be available from the webdeployment builds too?

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

Wednesday, September 19, 2007 4:38 AM by Egil

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.

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

Wednesday, September 19, 2007 5:06 AM by West

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 :-)

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

Wednesday, September 19, 2007 5:34 AM by Mohammed El-Sayed

Great job VS team.

and we all waiting for more.

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

Wednesday, September 19, 2007 5:41 AM by abi

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).

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

Wednesday, September 19, 2007 6:29 AM by Klaus Even Enevoldsen

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

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

Wednesday, September 19, 2007 7:46 AM by KC

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

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

Wednesday, September 19, 2007 8:04 AM by David Peck

Now that is using your noddle. Great news.

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

Wednesday, September 19, 2007 8:15 AM by Andrew Steele

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.

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

Wednesday, September 19, 2007 8:28 AM by D. Figuerres

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...

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

Wednesday, September 19, 2007 8:36 AM by Russ Painter

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.

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

Wednesday, September 19, 2007 9:27 AM by Michael

Thanks for this one!

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

Wednesday, September 19, 2007 9:57 AM by PBZ

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.

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

Wednesday, September 19, 2007 10:31 AM by ScottGu

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

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

Wednesday, September 19, 2007 10:53 AM by Aaron Fischer

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

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

Wednesday, September 19, 2007 11:13 AM by Ryan Ternier

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!

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

Wednesday, September 19, 2007 6:11 PM by Michael Sivers

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

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

Thursday, September 20, 2007 12:12 AM by Vikram

ys this is a really very very useful feature

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

Thursday, September 20, 2007 11:34 AM by rternier

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?

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

Thursday, September 20, 2007 11:57 AM by zack

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.

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

Thursday, September 20, 2007 11:59 AM by atomiton

"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.

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

Monday, October 8, 2007 7:59 AM by Anand

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