473,728 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12371
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 ConfigurationSe ttings 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 ConfigurationSe ttings 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 ConfigurationSe ttings 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.b et 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******** ******@TK2MSFTN GP10.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)i nova.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)i nova.ch
Jul 21 '05 #9

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

Similar topics

2
7275
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 the ups and downs of registry versus files but i can´t find it now. Can someone please help me? Thanks in advance! /Bobby
2
436
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 advantages of XML config files are promoted; 1. The .NET framework provides built-in support for reading application configuration data from .config files very easily 2. Using these files makes it possible to deploy an application using
22
3010
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 files, which in turn could be simply and easily maintained with notepad. I understand the benefits of XML, really, but in the case of configuration files it seems it is almost always nothing more than unnecessary complexity, both in accessing them...
6
11229
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 programs and executing registry entries. The majority of my buttons work however, I have come upon a problem. I need a few of the buttons to run DOS batch files, the batch files in turn run program installers (specifically windows update runtime .exe...
1
3190
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 programs and executing registry entries. The majority of my buttons work however, I have come upon a problem. I need a few of the buttons to run DOS batch files, the batch files in turn run program installers (specifically windows update runtime .exe...
2
1671
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... http://www.wwwcoder.com/main/parentid/263/site/2281/68/default.aspx what's the problem with a server side application reading data from a server
17
1601
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 Regards, Sam
8
302
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 guidelines for how to do this?
6
1680
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 object with 10 string items into the registry and retreive them later. I tried this: key.SetValue("lstNSXitems", lstNSX.Items) where "lstNSXitems" is the name of the subkey, and lstNSX.Items is the
0
8753
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9188
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8110
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6704
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4787
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2642
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2159
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.