Saving Settings for XSD2Code..???

Nov 21, 2012 at 5:30 PM


Excellent tool. Just getting used to it.

I am using it with VS2010 SP1. I find that I need to reselect my settings each time I run XSD2Code. I may be doing something wrong, but if not then it would be good to be able to save a session's settings.




Nov 25, 2012 at 8:56 AM

Xsd2Code, save settings in the header of generated code.
But it would be great to store (in registry for example) the default setting.

I keep this idear for next release.



Nov 26, 2012 at 9:55 AM

Hi Pascal,

One idea is to do something like what BeyondCompare does. It is an excellent file comparison tool. Within it you can save your current session's settings as a session file. Thus you can have a number of session files which you can choose from in the future. These may well be XML based, but not sure. I like this idea, particularly as you can save multiple sessions.


Jan 22, 2013 at 9:09 PM

Hello ESSB and Pascal:

Actually I've implemented a defaults feature. It still works in 3.4. I haven't personally tested it in later releases. But code/functionality is still be there.

I have been a submitter on this project, primarily to do some bug fixes on VB code-generation side and added the following feature.

I depend on it pretty heavily...Once upon a time there was some documentation on it. But I don't see the documentation anymore but it works like this:


The code will look for settings in 3 Locations in this order.

  1. [schemafilename].xsd.xsd2code if it exists and will use this file always for that schema. This represents Schema specific Settings.
  2. the header of the generated [schemaFilename].designer.[cs/vb] file if you've already run xsd2Code at least once.
  3. and finally a defaults.xsd2code file located in the same directory as the XSD file., if an only if neither of the other 2 files exists.

When using this from the command line, it functions when only the XSD file name is specified (arguments == 1).

It wouldn't be too hard add one more search path to the users Home directory. The registry? I didn't use the registry because I can't check that in.

There was a defaults.xsd2code.template file but its out of date.

The feature I want to add but didn't get around to was to be able to export the current settings. Like ESSB suggest.

Pascal this code is in GeneratorParams.LoadFromFile. You'll see the Logic there. Pretty simple to add a home directory, as the final case.