G
Guest
I am trying to create a custom configuration section that looks like so:
<global>
<environment name="x">
<appSettings>
<add key="foo" value="bar" />
</appSettings>
</environment>
<environment name="y">
<appSettings>
<add key="foo" value="bar" />
</appSettings>
</environment>
</global>
My custom ConfigurationSection class has the following property:
[ConfigurationProperty("environments", IsDefaultCollection = true)]
public EnvironmentConfigElementCollection Environments
{
get { return (EnvironmentConfigElementCollection)base["environments"]; }
}
I keep getting an error, "unrecognized element 'environment', line 2". Does
anyone have any ideas? At my wits ends here. It's my understanding from
examples in docs that "IsDefaultCollection" property tells .NET not to expect
a wrapper tag, so would think it would view the "environment" tag as a member
of the collection, but it doesn't appear to be working.
Thanks,
William
<global>
<environment name="x">
<appSettings>
<add key="foo" value="bar" />
</appSettings>
</environment>
<environment name="y">
<appSettings>
<add key="foo" value="bar" />
</appSettings>
</environment>
</global>
My custom ConfigurationSection class has the following property:
[ConfigurationProperty("environments", IsDefaultCollection = true)]
public EnvironmentConfigElementCollection Environments
{
get { return (EnvironmentConfigElementCollection)base["environments"]; }
}
I keep getting an error, "unrecognized element 'environment', line 2". Does
anyone have any ideas? At my wits ends here. It's my understanding from
examples in docs that "IsDefaultCollection" property tells .NET not to expect
a wrapper tag, so would think it would view the "environment" tag as a member
of the collection, but it doesn't appear to be working.
Thanks,
William