Here are some frequently asked questions about Windows Forms and their answers.
Browse by Tags
All Tags » Client Settings (RSS)
-
|
For information on using the a Web service for settings, see the following SDK sample: http://msdn2.microsoft.com/en-us/library/ms180994.aspx
|
-
|
For information on using the registry for settings, see the following SDK sample: http://msdn2.microsoft.com/en-us/library/ms181001.aspx
|
-
|
For information on when and how to use IPersistComponentSettings, see the whitepaper on MSDN on IPersistComponentSettings.
|
-
|
The configuration system is hierarchical and has the following ordering: Machine > Application > Roaming User > Local User When you query a configuration section at any level, you get a merged view of the sections declared in that level and those...
|
-
|
While most common types can be serialized in one of two ways listed above, there are some types that may not. In such cases, you have a few different options: Implement a TypeConverter for the type that can convert to and from string. The implementation...
|
-
|
There are two primary mechanisms that ApplicationSettingsBase uses to serialize settings: If a TypeConverter exists that can convert to and from string, it is used. Otherwise, the XmlSerializer is used.
|
-
|
The default SettingsProvider for client applications (called the LocalFileSettingsProvider ) stores settings in the application configuration files. In .NET v1 and v1.1, there were two levels of config files - machine.config and app.exe.config (where...
|
-
|
In non-Clickonce cases, there is no automatic upgrade - you have to call Upgrade yourself. Here is one idea for determining when to call Upgrade: Have a boolean setting called CallUpgrade with a default value of true. When your app starts up, do the following...
|
-
|
In Clickonce, when you install a new version of your application, ApplicationSettingsBase will detect it and automatically upgrade settings for you at the point settings are loaded.
|
-
|
It is easy to upgrade settings from a previous version of the application to the latest. Simply call ApplicationSettingsBase.Upgrade() and it will retrieve settings from the previous version that match the current version of the class and store them out...
|
-
|
The path algorithm mentioned above is not used in the Clickonce case. Instead, the local user.config file goes in the Clickonce Data directory (the <Version> part of the path will still be included). There is no roaming user.config file for Clickonce...
|
-
|
The LocalFileSettingsProvider does not provide a way to change the files in which settings are stored. Note : The provider itself doesn't determine the config file locations in the first place - it is the configuration system. If you need to store...
|
-
|
If you want to get to the path programmatically, you can do it using the Configuration Management API. For example, here is how you can get the local user.config file path: Note: You need to add a reference to System.Configuration.dll Configuration config...
|
-
|
There are a couple of reasons why the user.config path is version sensitive: To support side-by-side deployment of different versions of an application (you can do this with Clickonce, for example). It is possible for different versions of the application...
|
-
|
The path construction algorithm has to meet certain rigorous requirements in terms of security, isolation and robustness. While we tried to make the path as easily discoverable as possible by making use of friendly, application supplied strings, it is...
|
-
|
The path of the user.config files is structured as follows: <Profile Directory> \ <Company Name> \ <App Name> _ <Evidence Type> _ <Evidence Hash> \ <Version> \ user.config Where: <Profile Directory> - is either...
|
-
|
Application scoped settings are essentially read only from the application's point of view, and aren't meant to be changed by users, but rather only the administrator. An additional reason for this has to do with how the default SettingsProvider...
|
-
|
There are generally two main types of settings that applications want to store: Static data like connection strings and web references that don't change often, but should still be possible for an admin to change. User preferences and customization...
|