in a small c# project, I'm trying to create a simple custom configsection. I followed the instructions in CodeProject: Unraveling the Mysteries of .NET 2.0 Configuration and everything work nicely... apart from the fact that I don't get xsd validation and intellisense on the config.
My config is shown below.
<configuration>
<configSections>
<section name="pizza" type="TestConfig.Configuration.PizzaConfigurationSection, TestConfig.Configuration"/>
</configSections>
<pizza name="Margherita" timeToCook="00:10:00" price="15.12">
<cook firstName="Nicola" lastName="Carrer" rank="7" />
<toppings>
<add name="Mozzarella" percentage="0.6" />
<add name="Tomato sauce" percentage="0.28" />
<add name="Oregano" percentage="0.02" />
<add name="Mushrooms" percentage="0.1" />
</toppings>
</pizza>
</configuration>
On this article (XSDExtractor) I found a tool that creates an xsd file for the configsection. It works fine, i.e. it provides intellisense and validation, for the main attributes (e.g. "price") and the single elements ("cook"). However I could not make it work for the collections (the "toppings").
My questions:
- Is there any other tool that provides xsd generation of ConfigurationSection classes?
- Has someone run XSDExtractor successfully on a ConfigurationSection with a collection property?
Thanks a lot, Nicola
I haven't used XSDExtractor but one tool which I strongly recommend is Configuration Section Designer. It's a Visual Studio add-in that allows you to graphically design .NET Configuration Sections and automatically generates all the required code and a schema definition (XSD) for them.