473,412 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

INI files vs Registry vs XML

I believe the intent in .NET is that we store application
setup information in an XML file now instead of the
Registry or INI files. Is this correct?

Are there any tools, sample apps, or guidelines for how to
do this?
Jul 19 '05 #1
8 12321
Yes. MS wanted applications to be less intrusive in the
O/S if possible in order to support the XCopy deployment
that makes .NET so easy to deploy. Using the registry
generally requires a setup file and therefor negates a
lot of reasons for using .NET in terms of deployment (and
this will continue to become more of a problem when
Whidbey and the ClickOnce technology are released).

In terms of actually using the configuration file, see
the ConfigurationSettings class in the Configuration
namespace in the MSDN documentation.

Jeff Levinson

Author of "Building Client/Server Applications with
VB.NET: An Example Driven Approach"

-----Original Message-----
I believe the intent in .NET is that we store applicationsetup information in an XML file now instead of the
Registry or INI files. Is this correct?

Are there any tools, sample apps, or guidelines for how todo this?
.

Jul 19 '05 #2
Hi Dave,

Yes you can write to it as a normal XML file, to a
certain entent. I've found that modifying the nodes
(attribute values, etc.) is generally fine, but it's not
always possible to create new nodes. So it's still
limited. I'm starting to write my own config file
reader/writer to get around that, but as you said, it'd
be really nice if the ConfigSettings class lets us to
write to .config files.

Regards,
Donald Xie
-----Original Message-----
The one thing that everyone seems to fail to mention when responding tothese kinds of messages is that, using the ConfigurationSettings withthe .config file is only half a solution. You can read from it. To have somethingtruely usable it would be nice to be able to write as well.
Cheers,
Dave
On Mon, 11 Aug 2003 11:33:41 -0700, "Jeff Levinson [mcsd]" <je***********@comcast.net> wrote:
Yes. MS wanted applications to be less intrusive in the
O/S if possible in order to support the XCopy deploymentthat makes .NET so easy to deploy. Using the registry
generally requires a setup file and therefor negates a
lot of reasons for using .NET in terms of deployment (andthis will continue to become more of a problem when
Whidbey and the ClickOnce technology are released).

In terms of actually using the configuration file, see
the ConfigurationSettings class in the Configuration
namespace in the MSDN documentation.

Jeff Levinson

Author of "Building Client/Server Applications with
VB.NET: An Example Driven Approach"

-----Original Message-----
I believe the intent in .NET is that we store

application
setup information in an XML file now instead of the
Registry or INI files. Is this correct?

Are there any tools, sample apps, or guidelines for
howto
do this?
.

.

Jul 19 '05 #3
Yes, In .NET, it is recommended to use XML config file instead of registry
and INI file. Here is a sample:

HOW TO: Store and Retrieve Custom Information from an Application
Configuration File by Using Visual Basic .NET
http://support.microsoft.com/default...;EN-US;Q313405
Luke

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
http://www.microsoft.com/security/se...s/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026."

Jul 19 '05 #4
I don't think that the config file story was completely thought out. What we
have is very good, but the designers need to ask more questions about how it
will be used.

1) config files are not writable: you can use the System.Xml classes to
write to it, but it is a pain, and it takes too long to perform. Also once
you have written to a config file the values will be ready _only_ when a new
application domain is created, which usually means you have to restart the
app. (Contrast this to the registry and INI files).

2) config files are per app, so anyone using the same app will have the same
settings, contrast this to the registry where entries are written to the
HKCU hive. You can use isolated storage to store your own private config
files, but you will have to write your own class to read this data and the
values will not be used automatically for framework classes that need config
data

3) config files are simple text files so you cannot apply an ACL for
individual items. Contrast this to the registry (or SQL Server) where an
entry can have an ACL so that certain accounts are refused access to a value
(and presumably to a feature of the app that uses the value).

4) reading and writing to the registry (and items in a database like SQL
Server) is automatically multi-user. Thus more than one thread can read
different values in the registry at the same time. If you want to write to
the config file you'll have to be careful to make sure that your API does
not lock out other threads reading another section of the file. To make sure
that other threads are not locked out for reads, the config API caches the
values it reads into a in-memory HashTable, one for each appdomain.

I would have preferred a database implementation rather than a XML DOM based
implementation. I see few advantages in editing the config file by hand. I
like the following features of the config file:

1) the values read from machine.config and app.config are combined with the
app settings taking precedence
2) framework code get their configuration when they are initialized, because
of (1) it means that a config file distributed with the app would supply the
settings and machine.config does not have to be touched.

Richard
--
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)
"Bob Kirkwood" <ki******@k6mfg.com> wrote in message
news:07****************************@phx.gbl...
I believe the intent in .NET is that we store application
setup information in an XML file now instead of the
Registry or INI files. Is this correct?

Are there any tools, sample apps, or guidelines for how to
do this?

Jul 21 '05 #5
"Richard Grimes [MVP]" <read my sig> wrote in message
news:uZ**************@TK2MSFTNGP10.phx.gbl...
I don't think that the config file story was completely thought out. What we have is very good, but the designers need to ask more questions about how it will be used.

1) config files are not writable: you can use the System.Xml classes to
write to it, but it is a pain, and it takes too long to perform. Also once
you have written to a config file the values will be ready _only_ when a new application domain is created, which usually means you have to restart the
app. (Contrast this to the registry and INI files).


NOTE: This depends on the app type as ASP.NET will automatically recycle
when a new .config file is dropped.

I concur with the registry push over .config.
--
Gregory A. Beamer
MPV; MCP: +I, SE, SD, DBA

************************************************** ********************
Think outside the box!
************************************************** ********************
Jul 21 '05 #6
>I don't think that the config file story was completely thought out.
1) config files are not writable:
The app config files are intended strictly for application-wide
settings which are by default not going to change frequently. Since
they reside with the app, a normal user won't have write permissions
there anyway - so there's no need to make that file writeable.
2) config files are per app, so anyone using the same app will have the same
settings, contrast this to the registry where entries are written to the
HKCU hive.


As I said before - the app config files are intended as APPLICATION
CONFIGURATION FILES - not user settings files! They are - by design -
*NOT* user-specific - never intended to be. If you need to store user
settings, use some persistence mechanism into the isolated storage
area (e.g. streaming out a config object, or creating a XML-based user
preferences config file yourself).

Marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Jul 21 '05 #7
Marc Scheuner [MVP ADSI] wrote:
I don't think that the config file story was completely thought out.
1) config files are not writable:
The app config files are intended strictly for application-wide
settings which are by default not going to change frequently. Since
they reside with the app, a normal user won't have write permissions
there anyway - so there's no need to make that file writeable.


Well, yes, they are used essentially provided as a replacement for command
line switches, which, of course, do not have a concept of being writable.
However, the registry was used for many configuration things, and worked
very well for per user configuration items that could change.

Since Microsoft are discouraging people from using the registry, how should
we handle per user configuration items that could change? This is why I say
that it was not thought out well.
2) config files are per app, so anyone using the same app will have
the same settings, contrast this to the registry where entries are
written to the HKCU hive.


As I said before - the app config files are intended as APPLICATION
CONFIGURATION FILES - not user settings files! They are - by design -
*NOT* user-specific - never intended to be.


<sigh> I have said such things myself *many* times -just do a google search
on my name and config. I just don't agree with the features that have been
provided. Note that the poster was asking for a comparison between config,
registry and INI, and that is what I did.
If you need to store user
settings, use some persistence mechanism into the isolated storage
area (e.g. streaming out a config object, or creating a XML-based user
preferences config file yourself).


Oh I see: you have no option but to roll your own.

You say 'configuration files weren't intended to be user-specific and while
I agree that this is clearly the case I assert yet again that they *should*
have thought about these issues and taken them into account in the original
design. This is especially concerning since the mechanism that they are
trying to persuade us from using, has those very features.

Richard
--
..NET MVP
Jul 21 '05 #8
>You say 'configuration files weren't intended to be user-specific and while
I agree that this is clearly the case I assert yet again that they *should*
have thought about these issues and taken them into account in the original
design.


Yes, indeed - at least some form of "user-specific" or
"user-writeable" config files would have been nice. Then again -
they're really not that hard to do, plus there are tons of samples out
there already, so really, you can just pick one and use it, basically.

Also, if you have very complex and varied needs, you can always use
the Microsoft Configuration Management Application Block, right?

http://msdn.microsoft.com/library/de.../html/cmab.asp

Marc

================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Jul 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob Olsson | last post by:
Hello all! I´m going to develop a windows smartclient and can´t find the information I need. Where do I store user-settings like paths, background colour and so on. I´ve read an article about...
2
by: Tim Blizard | last post by:
I know this topic has been discussed before but I couldn't find any thread more recent than about 18 months and was interested in what conclusions people had come to recently. Invariably 3...
22
by: Daniel Billingsley | last post by:
Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes it could get some honest attention. VB6 had a some simple and fast mechanisms for retrieving values from basic text...
6
by: Charles Neitzel | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
1
by: Charles | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
2
by: Daniel Bass | last post by:
I've found this article on how to get ASP.Net to read/write from the server's registry, but it got heavily critted as being something that you should not do... ...
17
by: Sam | last post by:
Hi all If I only want to store screen location and size of my application in Windows Registry, which of the keys should I store this info? A sample code is greatly appreciated. Thank you ...
8
by: Bob Kirkwood | last post by:
I believe the intent in .NET is that we store application setup information in an XML file now instead of the Registry or INI files. Is this correct? Are there any tools, sample apps, or...
6
by: JOSII | last post by:
Getting a string of boolean value into and out of the registry is no problem. Here's the problem: Although you can place an object into the registry and retreive it, I need to place an ArrayList...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.