1

I have a .xsd file in my C# project. Before every build I would like to invoke xsd.exe to generate a .cs source code file from the xsd.

Sounds simple? It is not :-(

Problem 1 is to actually find xsd.exe from the pre build event command line. I couldn't solve this one, so I ended up adding xsd.exe to my project folder (-> problem solved).

Problem 2 is to actually call xsd.exe before the build. I use this command line in my pre build event:

$(ProjectDir)xsd.exe "($ProjectDir)MySchema.xsd" /c /out:"($ProjectDir)"

This call fails because of one little detail: ($ProjectDir) always ends with a trailing backslash. xsd.exe on the other hand does not accept a trailing backslash.

So far I could not find a solution for getting rid of the trailing backslash. Any ideas?

Boris
  • 8,551
  • 25
  • 67
  • 120

0 Answers0