CDATA in Custom Configuration Sections
Creating a custom configuration section with ConfigurationSection
as described in this MSDN article is less straightforward when you want to use more than just attributes (e.g. text or CDATA elements):
If you do as told, you’ll see this exception:
System.Configuration.ConfigurationErrorsException: The configuration section cannot contain a CDATA or text element.
Fortunately, creating a custom ConfigurationElement
and overriding its DeserializeElement
method does the trick:
Not rocket science but (hopefully now less) difficult to find online.