I have included a resource in my Visual Studio 2005 solution that was a file on the hard drive. It is a text file, that contains text, and has a .htm extension.
For months it worked fine, until I wanted to edit the contents of the text file. Suddenly Visual Studio insists on syntax checking the file as though it were an HTML file - when it is not.
i would really rather not workaround this bug in Visual Studio by forcing the file to be named:
SomeFilename.htm.VSbug.doNotRemove
rather than
SomeFilename.htm
Not everything that uses the file is Visual Studio, and it would be a shame to force everyone to change because of issues with Visual Studio.
Even more to the point - what did i originally do so that VS would (correctly) ignore randomly added text files - and how do i do that again?
Update One
Since some people are, of course, curious - here is the contents of the file:
SomeFilename.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
<META http-equiv="X-UA-Compatible" content="IE=edge">
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
</HEAD>
<BODY style="margin: 0 auto">
<DIV style="text-align:center;">
<A href="%PANELLINK%" target="_blank"><IMG border="0" src="%PANELIMAGE%" style="%IMAGESTYLE%"></A><BR>
%CAPTIONTEXT%
</DIV>
</BODY>
</HTML>
As you can see, the file does not contain html. Don't forget - the file's contents are beside the point.
Answer
Editing the file through Visual Studio is what triggers Visual Studio to think it has some jurisdiction over the contents of the resource file.
Deleting the file and re-adding it, as well as only editing the resource text file outside of VS, ensures that VS will not try to parse the file's contents.