XSD.exe Funkiness with Pre-Build Event
So I'm currently working on something where my domain ontology is maintained in XSD. In the beginning, it was no big deal to periodically run xsd.exe from the command line when I changed my XSD file. However, as my data types became larger in number, I really wanted to avoid constantly having to manually run the command line tool - so I added a pre-build event task.
"C:\program files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe"
"$(ProjectDir)Schema.xsd"
/classes
/n:$(ProjectName)
/o:"$(ProjectDir)"
Seems reasonable enough. However, when I run it, I get some weird error from xsd.exe about illegal characters in the path. I also notice that xsd actually changed my output path from "Pub.Domain" to "Pub_Domain" - What?!? I wish I could say that I knew why it does this - a friend suggested that this may be Vista-related? At any rate, if anyone knows why this is happening, please let me know. In the meantime, this works just fine.
md "c:\hld_temp"
"C:\program files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe"
"$(ProjectDir)Schema.xsd"
/classes
/n:$(ProjectName)
/o:"c:\hld_temp"
xcopy "c:\hld_temp\Schema.cs" "$(ProjectDir)" /Y
rd "c:\hld_temp" /S /Q
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using
I am currently the Editor-in-Chief for MSDN Magazine. I joined Microsoft in 2006 as a product planner with the certification team at Microsoft Learning. Prior to that, I spent my career as a developer and later as an architect. My main technology passions include pretty much anything on language theory, agile development, and service-oriented architecture.