0

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 particularly 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)?

anatolyg
  • 26,506
  • 9
  • 60
  • 134

1 Answers1

0

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.

xcut
  • 6,219
  • 1
  • 33
  • 27
  • Unfortunately, i cannot do it because i actually want it to be included in the build (i have a Custom Build Step for it). I guess I'll have to live with this bug/feature. – anatolyg Dec 07 '10 at 17:58