In my winform app, I am trying to add a userSetting, although the error is occuring with appSettings too. When the setting is added I get an exeption thrown that says: \"Con
The startup tag did the trick for me on VS Pro 2013 version 12.021005.1 with .Net 4.5.51650 for console application (i.e. app.config file)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionStrings>
...
</connectionStrings>
</configuration>
I had a this problem today and found that I'd accidentally (not to mention erroneously) added a second custom configuration section to my App.config. Once I removed the errant addition, I was able to continue running my application without problems.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="ABCConfig" type="ABC.Configuration.ABCConfigurationSection, ABC"/>
<!-- Other custom section definitions -->
</configSections>
<connectionStrings>
<!-- Connection strings go here -->
</connectionStrings>
<!-- Configure ABC -->
<ABCConfig CustomA="blah" CustomB="stuff" />
<!-- Other custom sections -->
<!-- Errant addition to Configure ABC which causes the problem - SHOULD NOT BE HERE -->
<ABCConfig CustomA="blah" CustomB="stuff" />
</configuration>
Removing the second ABCConfig section resolved my problem. Hope this helps!
I had this problem because I changed one application setting scope (from 'application' to user'). As I couldn't find a solution to resolve my problem, I decided to delete the settings file into the solution explorer. After that, I opened the properties, in the tab 'settings', I clicked where it was proposed to create the settings file. And a new settings file has been created with the values I defined into the previous settings file. I rebuilt my project and it worked well.
Probably the problem is that your config file doesn't comply with its schema. For example, this issue can be recreated by duplication the ConnectionStrings section.
I had some user settings, then removed all of them and started seeing this exception - but only when running the app without debugging. It worked fine when debugging the app. The reason is that user-level settings are "cached" in the Local Application Data folder, and in fact are not read from the MYAPP.exe.config. So what I did was go to C:\Users\MYUSERNAME\AppData\Local\MYCOMPANY\MYAPP.exe_Url_longnastyhash9982749827349879\1.0.0.0\user.config (this is on Win7, the path depends on OS) and removed that folder (with the long hash) altogether. The exception went away. BTW, depending on how your settings are setup this user.config file may be under \AppData\Local or \AppData\Roaming.