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.
To access XML formatting options, choose Tools > Options > Text Editor > XML, and then choose Formatting.
XML validation is the process of determining whether the structure, content, and data types of an XML document are valid. XML validation also strips off ignorable whitespace in the XML document.
You can validate your XML documents against XML schemas only; validation against DTDs is not supported. However, although you cannot validate against DTDs, you can insert documents that contain a DOCTYPE or that refer to DTDs.
DTD is the acronym for Document Type Definition. This is a description of the content for a family of XML files. This is part of the XML 1.0 specification, and allows one to describe and verify that a given document instance conforms to the set of rules detailing its structure and content.
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).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With