The application's configuration file is used to read and save simple local data, and the new profile in VS can be added directly to the project's "Properties"-"settings". After adding a set of two files in the Properties folder of the project: Settings.settings and Settings.Designer.cs, the former is an XML file for the VS interface display, the latter is a vs generated inherited System.configuratio The class Settingof N.applicationsettingsbase, which is strongly typed, makes it easy to read and save configuration items through code:
Alternatively, you can right-click Project-Add-new item-General-settings file Add (note that it is not an application configuration file). In this case, a project may have multiple sets of settings files, vs will automatically generate an app. config merge multiple sets of configuration items.
Then, in the program can use the properties. Settings. The Default.test1 property reads the settings through its Settings. The Save method saves the settings after the project is generated in the program directory according to app. exe.config's configuration file.
It is important to note that the type of configuration item is divided into "user" and "application", the former refers to each logged-on Windows user has a copy, the file changes will not affect other users, so the type of "user" configuration node is saved in C:\Users\bb\AppData\ Local\microsoft\ Program Name directory, and a number of different versions corresponding to different configuration files, and program directory program name. The corresponding configuration item for exe.config is not working.
The type "Application" is globally valid for the system, and its configuration items are stored in the program name under the program directory. exe.config, in the code, the properties. Settings. Default.test2 This "application" configuration item is read-only and cannot be written.
Configuration file in VS2008 App. Config Simple summary