settings.settings

How to change in runtime application settings

旧时模样 提交于 2019-12-30 23:34:20
问题 I'm trying to change in runtime one key of my applications settings file, but it does not work. I do on that way: ConfigurationSettings.AppSettings["XPTO"] = "HELLO"; It seems that it only changes in memory, not on the file. Does anyone knows how to do this? Thanks. 回答1: Take a look at my overview of .NET settings files...In short, I think you want a user-scoped setting. It will behave more like you expect. Edit: If you are using the settings designer in Visual Studio, then simply change the

How to persist changes in a .settings/.config file across a file version change?

血红的双手。 提交于 2019-12-25 11:48:54
问题 I have created an application that uses settings.settings to store some user specific settings (scope=User). Settings are loaded correctly on startup, changed during use and saved correctly for next launch. This cycle appears to have no problems. The problem arises when I update the assembly and file versions for a new build. The settings are no longer loaded on startup (instead the default values are used). It also appears that a config file saved from version 1.1 will persist even if

Application Settings “Profiles”?

廉价感情. 提交于 2019-12-25 08:48:26
问题 I am using this method to store settings for my program. I want the user to be able to choose and load different application settings at run time. (i.e. the user may want to load one group of settings for one scenario, and another group of settings for another). Can anyone recommend the best way to go about this? Do I need to use another method to read/write the profiles from disk to Settings.Default, or is it possible to use multiple instances of what I am using now without having to rename

Multiple settings files in .NET

和自甴很熟 提交于 2019-12-23 02:24:08
问题 I'm currently using My.Settings/Properties.Settings to store various user settings. Many of these settings are bound to controls in various Forms. However I want a greater degree of control - specifically I would like to be able reload or save specific groups of settings. Using the in-built Settings.settings file, I can only handle these settings as a single group. I know that I can create additional settings files, and this article (Summary section) suggests that if Settings.settings is not

Visual Studio generates “Settings1.Designer.vb” when I change a configuration setting

妖精的绣舞 提交于 2019-12-22 05:33:26
问题 Sometimes (not always), when I edit a setting in the "My Project" page, when I add one or edit a value from there, I get an error : 'Settings is ambiguous between declaration in Modules '<project>.My.MySettingsProperty' and '<project>.My.MySettingsProperty' Visual Studio creates a duplicate of My Project\Settings.Designer.vb , and registers both of them in the .vbproj file. When this happens, I need to delete Settings.Designer.vb, remove the "1" in Settings1.Designer.vb, and remove the

Trouble saving a collection of objects in Application Settings

≯℡__Kan透↙ 提交于 2019-12-17 19:40:55
问题 I'm trying to store a collection of custom objects in the Application Settings. With some help from this related question, here is what I currently have: // implementing ApplicationSettingsBase so this shows up in the Settings designer's // browse function public class PeopleHolder : ApplicationSettingsBase { [UserScopedSetting()] [SettingsSerializeAs(System.Configuration.SettingsSerializeAs.Xml)] public ObservableCollection<Person> People { get; set; } } [Serializable] public class Person {

C# Setup Project Custom Action to save the installation directory to custom setting file

柔情痞子 提交于 2019-12-12 03:23:53
问题 I am trying to make an application using windows installer as it's install method. When the installation succeeds I want to get the path where the primary output is located that I configured in the installer. In my case the primary output is in the folder [ApplicationData(Installroot)]\Bin\ . I also have a custom settings file called App.Settings in 1 my Class Library which controls several settings like file locations who are relative to the install location. So the idea is that when the

Using Properties.Settings.Default and Setting Alternate Profiles?

别等时光非礼了梦想. 提交于 2019-12-11 01:33:23
问题 Greetings StackOverflow, In past projects I've gotten used to using the Settings Designer in Visual Studio to make settings files. This has worked well in the past. In my latest project I have a desire to have multiple version, a.k.a. profiles, of the same Settings class, one with production/default values for all the properties and one with test values. While in search to see if this is possible I noticed that in the XML for the Settings.settings file there are multiple hints that having

Settings.setting gives the different values in Debug mode

自古美人都是妖i 提交于 2019-12-10 11:35:58
问题 First strangeness: I really wonder why do I get the different values from Settings.settings file in the debug and non-debug modes. In other words I start my application in the without debugging (run-> start without debuging) and in the debug modes (rub-> debug). And it always gives me the different values for the same key in these modes. Second strangeness: When I change the values stored in Settings.settings file with my application at runtime, the values aren't changed. I see the previous

Why did my Visual Studio 10 stop using App.Config for my SQL connection string?

一个人想着一个人 提交于 2019-12-08 13:32:50
问题 I have a working database application using WPF and SQL Server 2008 R2, which for two years has been getting its SQL Server connection string from the App.Config file. A few days ago on one dev machine, it started ignoring the App.Config file's connectionString, and is now using a string from somewhere else (looks like either settings.settings, or the DBML file). Why might this be happening, and how can I get it to stop doing that? The app.config starts out like this: <configuration>