Home All Groups Group Topic Archive Search About

MSDatasetGenerator schemaLocation problems.

Author
11 Jan 2007 5:52 PM
Sean Abernathy
I'm in the process of converting a number of Visual Studio 2003 projects to
Visual Studio 2005 SP1.  We have .xsd files that use MSDatasetGenerator to
generated typed DataSet's. Upon converting to 2005 DataSet generation of all
xsd's that reference other xsd's through xs:import now fail. All
schemaLocation attributes reference other xsd's through a relative path. If I
change the schemaLocation to an absolute path the DataSet generates fine. I
can also use the xsd.exe command line tool to generate DataSet's for xsd's
with relative paths as long as I execute the command in the same directory as
the target xsd.
  It should be noted that xs:include works properly with the schemaLocation
set to relative paths. Using reflector on the Microsoft.VSDesigner.dll I was
able to verify that the DataSet generator specifically fixes paths for the
xs:include element by turning relative paths to absolute paths, I couldn't
find anywhere where it attempted to update paths for the xs:import element.
  The xsd's in question have been published and are not allowed to change.
The only decent solution I can think of now is to have a pre-build event in
the project that would move to each directory with xsd's and execute xsd.exe
to generate the .cs file. I would include those .cs files in the project
explicitly and not use the MSDatasetGenerator custom tool.
  My questions are: Is there a better solution to this problem? Maybe my
build environment is hosed up?

AddThis Social Bookmark Button