Reputation: 100312
I created a setting called StartLocation
And then I tried to use it on Form_Load
event
var x = Settings.Default.StartLocation;
When I am running my program from withing Visual Studio, I don't get any errors. When I run the compiled version in Debug mode, everything works fine.
But then, when I try to run in Release
mode outside Visual Studio I get this error
Configuration system failed to initialize exception
My WPower.exe.config
file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WPower.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<userSettings>
<WPower.Properties.Settings>
<setting name="StartLocation" serializeAs="String">
<value>200, 250</value>
</setting>
</WPower.Properties.Settings>
</userSettings>
</configuration>
I tried cleaning up the solution and recompiling... I tried to overwrite the config file with the on in the debug folder... But I always get this error no matter what.
Why is that? Why when I run in Release
outside Visual Studio I get this error?
Upvotes: 1
Views: 3238
Reputation: 100312
I had a different project on the same folder.
I found that the settings are stored at
...\User\AppData\Local\WPower
So I deleted the old files and re-run the application.
Upvotes: 2