Visual Studio 2005 keeps "recompiling" XML Schema
I have the following inconvenience while working with MS Visual Studio.
My project contains some C++ code, and a Schema file (with extension .xsd
).
I have a "custom build step" for converting the file to a C source; the generated file looks thus:
extern const char xmlSchema[] = {
0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20, // <?xml ...
...
}
I noticed that when i edit the schema file outside Visual Studio, or perhaps download a new version from a source control system, Visual Studio immediately notices that and invokes the Custom Build step (which i would expect it should do only when i "build" my project).
This is particularl开发者_StackOverflow中文版y awkward when my project happens to be running (i get a Do you want to stop debugging?
dialog out of the blue), and can result in lost edits (never happened during real work but possible).
This doesn't happen if i rename my file to have a non-standard extension (e.g. .xsk
), but i don't like this because i lose syntax highlighting (and it just seems wrong).
I would like to get ideas and insights on this:
Is there a reason for this "feature", or is it just a random quirk?
Any better workaround possible?
Maybe you are using another MS-VS version, and it doesn't happen for you (i am using MS-VS 2005 Standard Edition)?
That is, indeed, very annoying. Exclude the schema from your build. Make sure you do it in all build configurations.
Right-click on the schema and open the properties dialog. Under "Common", set "Excluded from Build" to true.
精彩评论