473,903 Members | 3,258 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Registry vs Config files

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
XCOPY and remove it using DEL directory

3. Storing application data in config files may allow it to be
executed on a non-Microsoft .NET platform

However it seems to me that there are strong arguments that invalidate
much of these advantages.

Firstly, the .NET framework support for .config files provides
read-only support but no support for writing data. This makes it more
difficult to save runtime application data (such as form position or
MRU file list). While the .config file could be treated as a standard
XML file and written to, they can be quite complex and most people
seem to agree that you might as well save your data to a custom XML
file instead.

This raises the issue of where to store this new custom XML file. If
it is not stored in the application directory then it is likely to be
overlooked in any subsequent deployment or application removal.
Storing it in the application directory requires the user to have
write access to the application directory. This is often undesireable
and counter to efforts by Microsoft to remove write access to the
Program Files directory tree from 'ordinary' users.

Furthermore, often runtime application data like this is expected to
be saved on a user-by-user basis. This either results in a single
large 'multi-user' save file in the application directory, or many
individual user save files in the application directory (both
requiring the user to have write access) or saving the data in a file
in the user's My Documents area (back to the file getting left
behind).

Many people seem to keep coming back to being able to deploy an
application using XCOPY but I fail to see why this is so important.
Most applications are deployed using an installation scripting tool
and will this will continue as far as I can tell. Beyond copying the
application's files, there are many other tasks that may need to be
completed to fully install a typical application;

a. Associating file types with the application
b. Registering any legacy COM objects (at least for a while yet)
c. Ensuring that any required assemblies are installed
d. Setting up .NET security (such as Code Access Security)
e. Installing a service perhaps

All this suggests to me that the only truly legitimate benefit is the
'possible' ability to run the application on a non-MS platform.

But on the flip side, the Registry seems to continue to offer
significant benefits;

a. Automatically looks after user-by-user data stroed in HKCU and
,when coupled with roaming profiles, ensures that user data is
available wherever the user logs on to the network
b. Provides a single centralised repository for this information
allowing Administrators to reasonably easily locate such data without
having to search the hard drive
c. Coupled with network policies, standard user registry settings can
be setup automatically
d. Provides a ready-built management application (regedit) for
maintaining this information
e. Administrator may be able to access the registry remotely to make
adjustments
f. Registry keys are securable objects allowing the Administrator to
establish who can have access to make changes
g. The registry has a semi-secure area for the storage of sensitive
information

I am about to start porting an existing application framework to .NET
and it currently makes extensive use of the registry. I am interested
in what other developers are doing and what you think about my logic
outlined above.

Beyond platform portability which is not high on my list at this time,
why shouldn't I continue to use the registry?
Nov 22 '05 #1
2 2793
Hi Tim,

There is nowhere written that you should use one approach you can use by
instance the registry for
the last form settings
last path when it is Access

You can use by instance an XML file for language dependable texts which are
not standard in the framework or the OS (advantage, later when needed
someone who speaks a language you do not know can add that language to your
program)

Just some thoughts,

Cor
Nov 22 '05 #2
Tim Blizard wrote:
Firstly, the .NET framework support for .config files provides
read-only support but no support for writing data. This makes it more
difficult to save runtime application data (such as form position or
MRU file list). While the .config file could be treated as a standard
XML file and written to, they can be quite complex and most people
seem to agree that you might as well save your data to a custom XML
file instead.

This raises the issue of where to store this new custom XML file. If
it is not stored in the application directory then it is likely to be
overlooked in any subsequent deployment or application removal.
So, all you have to do is to (1) check for it's existance on the start of
your application and (2) write a fresh copy if it's not there.

PS -- This same problem would apply to the config file, or an INI file, or
with the Registry for that matter if you moved the app to a new computer or
had a new user log in and try to use it ( assuming that the entries are not
system wide ).
and counter to efforts by Microsoft to remove write access to the
Program Files directory tree from 'ordinary' users.
There are plenty of sanctioned places to put it then. How about the
Temporary Files folder inside of Local Settings ?
application's files, there are many other tasks that may need to be
completed to fully install a typical application;
And that is why .NET and Visual Studio provide for creating a setup
application as part of a solution.

But on the flip side, the Registry seems to continue to offer
significant benefits;


The Registry is the "dll hell" of configuration. XML is the obvious way to
go.
Nov 22 '05 #3

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

Similar topics

3
2631
by: Rohit Santhanam | last post by:
As I am reading the .NET documentation, I get the feeling that Microsoft is trying to get rid of the registry. My understanding is that an application built using .NET does not use the registry at all. So, conceivably as applications are migrated to .NET, the registry could disappear in a future version of Windows. Does anybody out there agree with me? Of course, they might keep the registry for backward compatibility purposes.
2
7342
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
8
12386
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?
1
1036
by: Martin Harran | last post by:
I understand that MS are encouraging developers using the NET platform to move away from storing application related data in the registry and to store it in data files instead. Is there a "best practice" in regard to the type of data files to be used - is there, for example, a move back towards the former 'ini' file types? I realise this is a fairly general question and would appreciate links to anywhere that this is/has been discussed.
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
10
8221
by: Clint | last post by:
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that does nothing but return "true" (this will obviously change once the program's fully built to actually do something, but for testing, it works). The only code I added to the service is below:
2
1680
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
1614
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
2
2260
by: newscorrespondent | last post by:
Is there an MSDN article that I can't find on replacing the registry calls (Registrykey.GetValue, Registrykey.SetValue) with the calls to get and put the same data in app.config? Thanks Tom
6
1687
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
9999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9847
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,...
0
11282
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10983
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
10500
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
7206
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4308
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.