Hi all,
I was trying to find an easy way to write in the standard configuration
(like app.config) xml-based files. I found classes that can be used to read
this information (in System.Configuration) like the
ConfigurationSettings.AppSettings property, but I was not able to find
anything to write app settings in these files. Isn't this kind of
"asymmetrical"? Anyone familiar with the reasons of such a lack?
Thanks a lot,
Ivan Ivanov
Herfried K. Wagner [MVP] - 09 Sep 2003 01:47 GMT
Hello,
"msnews.microsoft.com" <ivan.ivanov@tecan.com> schrieb:
> I was trying to find an easy way to write in the standard
> configuration (like app.config) xml-based files. I found
[quoted text clipped - 3 lines]
> anything to write app settings in these files. Isn't this kind of
> "asymmetrical"? Anyone familiar with the reasons of such a lack?
config files should not be modified by the application, that's why there
are no methods available for modifying them. Nevertheless, you can use
the XML classes provided by the framework to make changes to the config
files.
The config file should not be used to save user preferences. You can
use something like this instead:
http://www.palmbytes.de/content/dotnet/optionslib.htm

Signature
Herfried K. Wagner
MVP ? VB Classic, VB.NET
http://www.mvps.org/dotnet
Tom Dacon - 09 Sep 2003 01:47 GMT
For personal settings, it appears that MS recommends that you maintain a
separate file to hold them. The official story for the app config file is
that it's intended to be read-only and to contain more or less invariant
application settings, independent of any user preferences. You can use a
separate XML file, for instance, to maintain user preferences. I'd suggest
that you consider keeping such a file in isolated storage (see the
IsolatedStorage class for details).
Tom Dacon
Dacon Software Consulting
> Hi all,
>
[quoted text clipped - 8 lines]
>
> Ivan Ivanov
Christoph Schittko [MVP] - 09 Sep 2003 02:20 GMT
I agree with all of the above. You can find the reasons why app.config files
are not writable in the the Windows Logo Requirements [0]. However, you can
still leverage the same programming model for user specific settings if you
intergrate Microsoft's Confiuration Management Application Block [1].

Signature
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor
[0] http://www.microsoft.com/winlogo/software/tech_req.mspx
[1]
http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=01875f69-9358-43
7b-a8ae-fa4bf2e3080f
> Hi all,
>
[quoted text clipped - 8 lines]
>
> Ivan Ivanov
msnews.microsoft.com - 09 Sep 2003 17:18 GMT
Thanks a lot for the input.
I did not mean that I want to necessarily write in the app.config file. I
was looking for .net support for writing user settings in any kind of .ini -
like file (or registry settings for that matter, even though MS does not
recommend using the registry now!). I know that I can use XMLReaders and
such but I was looking for a 1 - line solution like good old
WritePriveteProfileString or so.
Thanks,
Ivan
> I agree with all of the above. You can find the reasons why app.config files
> are not writable in the the Windows Logo Requirements [0]. However, you can
> still leverage the same programming model for user specific settings if you
> intergrate Microsoft's Confiuration Management Application Block [1].
http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=01875f69-9358-43
7b-a8ae-fa4bf2e3080f
> > Hi all,
> >
[quoted text clipped - 9 lines]
> >
> > Ivan Ivanov
Christoph Nahr - 09 Sep 2003 19:48 GMT
>I did not mean that I want to necessarily write in the app.config file. I
>was looking for .net support for writing user settings in any kind of .ini -
>like file (or registry settings for that matter, even though MS does not
>recommend using the registry now!). I know that I can use XMLReaders and
>such but I was looking for a 1 - line solution like good old
>WritePriveteProfileString or so.
There are three classes devoted to simplifying registry access, by the
way. Check out the System.Microsoft.Win32 namespace.

Signature
http://www.kynosarges.de