472,333 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 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 12223
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! Im going to develop a windows smartclient and cant find the information I need. Where do I store user-settings like paths,...
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...
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...
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....
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....
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...
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...
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...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.