Saving app configuration settings
Posted on 2013-11-23
I use the Settings tab of the Projectt Properties page (VS 2012, C#) to create application configuratioon settings. I can read them just fine in code. But when I try to modify them I get an error. Because I'm using the settings tab, I can write code like this to read settings fine.
string team = Properties.Settings.Default.Team;
where Team is a setting I made. According to MSDN, I should be able to modify then save settings in code like this.
Properties.Settings.Default.Team = "My team";
But when I try to set the value I get this error: Error 5 Property or indexer 'GameCenter.Properties.Settings.Team' cannot be assigned to -- it is read only D:\Programs\GameCenter\GameCenter\GCSettings.cs 57 13 GameCenter
I have tried using Configuration = config = ConfigurationManager.OpenExeconfiguration(. . .) and then working with the appsettings.settings stuff but I can't even read doing that because I think I'm using the prefered newer way of handle configuration. Any thoughts on why I can't write back to the app.config file?