Monday, September 10, 2018

How can I use multiple application setting profiles?

(Cross-posting my stackoverflow question)

It seems to me that the Application setting system of .NET should support multiple "profiles" for the application scope.

In fact, it seems that there are traces of it even in the generated .settings files. As an example, consider this settings file that I generated via Visual Studio:

<?xml version='1.0' encoding='utf-8'?> <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="myProject.Properties" GeneratedClassName="FooClass"> <Profiles /> <Settings> <Setting Name="Foo" Type="System.Int32" Scope="Application"> <Value Profile="(Default)">3</Value> </Setting> </Settings> </SettingsFile> 

There are 3 things that draw my attention:

  • A CurrentProfile attribute in the SettingsFile element;
  • a Profiles section;
  • a Profile attribute for each setting in the file.

It would be great if I could keep multiple profiles of my application settings directly in that file. However, I can't seem to find any documentation for it.

Does anybody know how to use this feature (or even if it is implemented at all)?

How can I use multiple application setting profiles? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team