I'm not getting as how to write a message in app.config which consists of two or more lines. My usual code in config file is :
add key="msg_test" value="This is test message."
And I read it in c sharp code like :
ConfigurationSettings.AppSettings[msg_test];
And I want to write something like
add key="msg_test" value="This is test message \n are you sure you want to continue?"
However, you should be able to do it via API. e.g. try this: Add an App Setting with a new line, e.g. "test": "1234 5678" Show activity on this post. You can do it through Azure PowerShell task, but just remain newline symbol, the value won’t be in multiple lines, for example:
On the menu bar, choose Project > Add New Item. The Add New Item dialog box appears. Expand Installed > Visual C# Items, and then choose the Application Configuration File template. In the Name text box, enter a name, and then choose the Add button. A file named app.config is added to your project.
When you build your project, the development environment automatically copies your app.config file, changes the file name of the copy to match your executable, and then moves the copy to the bin directory. On the menu bar, choose Project > Add New Item. The Add New Item dialog box appears.
You can just use line breaks in the value:
add key="msg_test" value="This is test message."
You can also use XML encoded characters:
add key="msg_test" value="This is test message."
(I have tested both, and they work.)
The XML escape for newline is 

, so this should work:
<add key="msg_test" value="This is test message 
 are you sure you want to continue?">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With