user1438082
user1438082

Reputation: 2748

Configuration Setting

This setting is not allowed in App.Config due to the error The element app settings has invalid element 'BscSerialNumber'. List of possible elements expected 'add,remove,clear'

  <add key="PreValue" value="<BscSerialNumber>"/>

The value <BscSerialNumber> is an actual string that i want in my setting.

Upvotes: 0

Views: 372

Answers (1)

Lars Kristensen
Lars Kristensen

Reputation: 1495

You need to escape the angle-brackets. Use &lt; instead of < and &gt; instead of >.

The appsetting entry should end up looking like this:

<add key="PreValue" value="&lt;BscSerialNumber&gt;"/>

When you read the setting in code, it will contain the string, including the angle-brackets:

enter image description here

Upvotes: 3

Related Questions