views:

743

answers:

3

I have a bunch of Velocity template files in a Visual Studio 2008 project, the problem is that despite the fact that the extension is .vm instead of .xml or similar Visual Studio thinks that the HTML they contains must conform to XML naming standards and generates errors (not just warnings even) on each compilation.

How do I tell Visual Studio to ignore these "faulty" XML files? I am willing to turn of all validation on XML but I have found no such option either.

Update, the errors don't stop the build they just drown the real errors behind about 20 validation errors. I seem to remember an option to turn off validation in VS 2005 but I can't find any such option in VS 2008.

I'm accepting adding ## to the beginning of the file as answer, it does the trick even if it's ugly. Thanks Nir!

Update 2 I thought I had tried your answer before Marc and found that it wasn't properly remembered. But now that I tried it again it does work very well, and it's cleaner than adding a comment to every file. Re-rewarding the accepted answer.

A: 

Have you tried: right-click on a .VM file, select Properties. There you can change the Build Action, you might want to set it to either Content or None.

steffenj
The files currently have "None" as build action, and they are still validated. I was unclear in that the Errors don't stop the build though.
kaa
+1  A: 

I add a comment as the first line of the vm file, that way the file doesn't begin with a < and VS doesn't think it's an xml file.

Just add ## as the first line of every file then close and reopen it.

Nir
+3  A: 

Xml errors usually only show if the file is open.

You can normally disable it by not opening it into the xml editor; the errors don't normally stop a build - they just look like they do. Right click -> Open With... Source (Text) Editor (or HTML if you prefer) (and set as default).

Marc Gravell