C # error: unrecognized userSettings configuration section - stop reading user.config program?

In my C # form application (created in VS2010 using .NET 4.0), I use the application parameter to store the output path.

This setting was previously configured with a user area, but I had to change its scope.

After that, I now get the Unrecognized configuration section userSettings error message when the form starts (note that the program was executed before the configuration area was set by the user):

InnerException: System.Configuration.ConfigurationErrorsException Message=Unrecognized configuration section userSettings. (C:\Documents and Settings\Administrator\Local Settings\Application Data\CallCenterForm\CallCenterForm.vshost.exe_StrongName_bplf30wziudnpq0knzaacfuyomd5rv45\1.0.0.0\user.config line 3) Source=System.Configuration BareMessage=Unrecognized configuration section userSettings. Filename=C:\Documents and Settings\Administrator\Local Settings\Application Data\CallCenterForm\CallCenterForm.vshost.exe_StrongName_bplf30wziudnpq0knzaacfuyomd5rv45\1.0.0.0\user.config 

So, after some lookup, this seems to be caused by the old user.config file that still exists on the system, causing the program to read it and throw an error (I'm not sure what the actual underlying problem is). I can also confirm that when the file is deleted, the problem disappears.

Which leads me to my question, is there a way to change the program so that it does not read the old user.config file, because deleting it manually is not ideal, since the program already works on several systems.

Sorry if this was covered, but I could not find the answer.

If it is useful here, the contents of my App.config file are:

 <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="CallCenterForm.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0"/> </startup> <applicationSettings> <CallCenterForm.Properties.Settings> <setting name="saved_output_dir" serializeAs="String"> <value>c:\</value> </setting> </CallCenterForm.Properties.Settings> </applicationSettings> </configuration> 
+16
c # app-config
source share
4 answers

Today I ran into this error. The solution was to enter the information dialog about the assembly of project properties and promote the assembly and file version information (for example, from 1.0.0.0 to 1.0.1.0), save the changes and rebuild the application. This will force the compiler to reconsider the configuration and force the application to refrain from creating and reading a new user.config file corresponding to the new version, due to the lack of user settings in the new version.

+31
source share

What did the App.config app look like when user.config was? I assume that you still need to declare the <sectionGroup name="userSettings" ... > way it was declared.

+7
source share

I had the same problem. I had to clear and rebuild the solution. This solved the problem.

0
source share

You can fix the error by going to the current directory in which the user settings for your application are saved. This will be in% system% \ users \ your_user \ AppData \ Local \ Microsoft \ YourApp.vshost. ###### \ version. or delete the user.config file, clean your solution and rebuild everything. This should solve the problem.

0
source share

All Articles