Auto generated code and how to use the output.

Dec 11, 2009 at 1:07 PM

Hi all

Nice product, one problem - Ive created a new config section designer, can add section configs, collections and elements but the .cs, .config and .xsd file are empty when I save.....plus how do I then use this designer in my own App.config.

Thank you.

GE

Coordinator
Dec 11, 2009 at 2:22 PM

Check your error list. Does it show any problems? It should tell you if there's something that's wrong.

Dec 11, 2009 at 2:29 PM

I get:

Warning    1    The custom tool 'CsdFileGenerator' failed.  Project unavailable.    ConfigurationSectionDesigner.csd   

Warning    2    The 'codeGenOptions' attribute is invalid - The value 'Singleton, XmlnsProperty' is invalid according to its datatype 'http://schemas.microsoft.com/dsltools/ConfigurationSectionDesigner:ConfigurationSectionCodeGenOptions' - The Enumeration constraint failed.   ConfigurationSectionDesigner.csd

Warning    3    The 'codeGenOptions' attribute is invalid - The value 'Indexer, AddMethod, RemoveMethod, GetItemMethods' is invalid according to its datatype 'http://schemas.microsoft.com/dsltools/ConfigurationSectionDesigner:ConfigurationElementCollectionCodeGenOptions' - The Enumeration constraint failed.   ConfigurationSectionDesigner.csd

GE

 

Dec 11, 2009 at 2:37 PM

I've changed the Property "codeGenOptions" to be None now so I only get the top error now.

GE

Coordinator
Dec 11, 2009 at 2:53 PM

The codeGenOptions warnings are harmless, they are shown because Microsoft attempts to place more than one enum value in the XML while the XML schema they generate says it only allows one.

 

Dec 11, 2009 at 2:56 PM

The files are still empty though.

GE

Dec 11, 2009 at 3:14 PM

To fix the above - exit Visual Studio, reopen Solution, select the .csd file, right click, select "Run Custom Tool".

GE

Coordinator
Dec 12, 2009 at 9:54 AM
garethevans1986 wrote:

how do I then use this designer in my own App.config.

I wrote an example in a different thread that might help you figure out the way. I hope that helps. If not, feel free to ask some more. I'll be happy to be of assistance.