Reputation: 19074
I'm writing a two-project solution with a class library designed for re-use, and an application which will consume said class library. The library has a Properties file which is needed both in the library itself and in the application. Unfortunately when I tried to implement this the "obvious" way, by keeping the properties in the Class library and accessing it from the application by fully specifying LibraryName.Properties...
, it failed (which only goes to show that instinct is a poor substitute for knowledge).
I'm getting the following error:
System.Configuration.ConfigurationErrorsException was unhandled
Message=Configuration system failed to initialize
Source=System.Configuration
BareMessage=Configuration system failed to initialize
Line=0
StackTrace:
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
at System.Diagnostics.TraceInternal.InitializeSettings()
at System.Diagnostics.TraceInternal.get_Listeners()
InnerException: System.Configuration.ConfigurationErrorsException
Message=Unrecognized configuration section userSettings. (C:\Users\CPFOHL\AppData\Local\CompanyName\ProductName.vshost.exe_Url_irhjcfvtmdm11v2ub0re3en5hgllqjz4\10.0.0.0\user.config line 3)
Source=System.Configuration
BareMessage=Unrecognized configuration section userSettings.
Filename=C:\Users\CPFOHL\AppData\Local\CompanyName\ProductName.vshost.exe_Url_irhjcfvtmdm11v2ub0re3en5hgllqjz4\10.0.0.0\user.config
Line=3
StackTrace:
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object sender, InternalConfigEventArgs e)
InnerException:
The only other information I can think to share is that I have the two projects in separate solutions, and I added the Library with "Add Existing," but that doesn't feel like the error...
I'm sure there's an easy answer, let me know if I can post any extra information.
[EDIT] I'm pretty sure that the Settings are configured correctly. The worked until I moved them to a separate solution. I then moved them back in and have been regretting it since... When I click Synchronize in the Settings editor I get the following:
No user.config files were found in any of the following locations:
It then lists all the places it looked (mostly in User/CPFOHL/AppData). I hope that helps.
Upvotes: 0
Views: 840
Reputation: 131152
Can you try deleting C:\Users\CPFOHL\AppData\Local\CompanyName\ProductName.vshost.exe_Url_irhjcfvtmdm11v2ub0re3en5hgllqjz4\10.0.0.0\user.config
Perhaps you changed the type on one of the properties and an old one was already persisted to the per user store.
Upvotes: 1