Can I use it in my App.Config?

Jan 14, 2010 at 7:35 PM

Hello,

I must say, after trying to do some more complex custom configuration settings for the first time, I was glad to stumble upon this tool.  I love it - mostly!

What I mean is it seems to work great.  However, I do NOT want an extra .config file if I can help it.  I would like to be able to just reference the Config project or .dll (as created in the tutorial) and just add to the configSections element.  Then somewhere in the App.confg actually get the intellisense just like all of the standard sections get.

Is this possible it CSD's current state?  Am I just missing something?

Thank you for what you have though!

Kevin

Coordinator
Jan 14, 2010 at 8:27 PM

To get intellisense in a configuration file, you must put the right namespace on the configuration element, just like in the example configuration file, e.g.

<SomeSection xmlns="theNameSpace">
    ...
</SomeSection>
and the generated XML schema which describes that namespace must either be in the same folder as the .config file is, or it must be placed in <Program Files>\Microsoft Visual Studio 9.0\Xml\Schemas. That should be all it takes. Let me know if you need more help.

Coordinator
Jan 14, 2010 at 8:58 PM

One more thing, to get it to work in your App.config, your project must (naturally) have a reference to the custom configuration dll, and the <section> element in the <configSections> element must have a full type attribute, like so:

<configuration>
	<configSections>
		...
		<section name="SomeSection" type="MyConfigSectionHandler.SomeSection,MyCustomConfigurationHandler,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" />
		...
	</configSections>
	<SomeSection xmlns="theNameSpace">
		...
	</SomeSection>
</configuration>