473,385 Members | 1,553 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,385 software developers and data experts.

Using a different filename for App.config

Hello,

By default, when you create an App.config file it gets named as
MyApp.exe.config after build. I don't like this name and would rather
have the file named MyApp.config, the .exe.config thing might confuse
my users. Is there any way to do this, or am I stuck with
MyApp.exe.config??

Thanks.

Dec 22 '05 #1
12 3796
Hi,

<sh****@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hello,

By default, when you create an App.config file it gets named as
MyApp.exe.config after build. I don't like this name and would rather
have the file named MyApp.config, the .exe.config thing might confuse
my users. Is there any way to do this, or am I stuck with
MyApp.exe.config??


AFAIK there is no way to change it IF you want to use the framework supplied
classes, of course there is nothing to prevent you from creating your own
file (and format ) and just read the configuration from this file, it's just
that you will have to c reate all the functionality.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Dec 22 '05 #2
Aside from rolling your own config, you're stuck, I believe.

You can specify an external file for your appSettings, though, if that's
what your users are going to need to mess with, though. I don't remember the
parameter name exactly, but if you're using VS 2005, you can go to the
appSettings secion, and get intellisense for the settings on the appSettings
section. It will look something like this:
<appSettings file="myApp.config" />
All key/value pairs would move into myApp.config. I also don't believe that
it has to end with .config.

It's been my experience that if you're programatically modifying your
appSettings, you'll have problems.

"sh****@gmail.com" wrote:
Hello,

By default, when you create an App.config file it gets named as
MyApp.exe.config after build. I don't like this name and would rather
have the file named MyApp.config, the .exe.config thing might confuse
my users. Is there any way to do this, or am I stuck with
MyApp.exe.config??

Thanks.

Dec 22 '05 #3
ummm... confusing to your users? they shouldn't be looking at it
anyhow (by default, most of them won't even see the extension in
Windows Explorer). But more importantly, how about: confusing to
future maintainers of your code or confusing to the administrator of
your app?

There is no reason to do this.

Dec 22 '05 #4
Ok I guess I had some misconceptions about the App.config file. What am
I "supposed" to store in this file if not user options and things like
that?

Suppose I just want to remember user settings. What is the "best" way
of doing this with C# .NET? Just come up with my own format and
manually parse my file?

Dec 23 '05 #5
App.config is generally read only anyways. (right?) And shared by all users.

If you had VS 2005/VB.NET there is a new My.Settings which supports this out
of the box. (cool!)

Otherwise there is a lot of options. The simplest (for me) was to save all
settings in a class and just serialize it to disk as an .xml file in the
user's profile directory.

I've am currently using the approach described here:
http://msdn.microsoft.com/library/de...et07082003.asp

Greg

<sh****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Ok I guess I had some misconceptions about the App.config file. What am
I "supposed" to store in this file if not user options and things like
that?

Suppose I just want to remember user settings. What is the "best" way
of doing this with C# .NET? Just come up with my own format and
manually parse my file?

Dec 23 '05 #6
http://www.vb2themax.com/ShowContent...a-04c861fac4a5

(Thank m.posseth for link)

Greg

"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:eI**************@TK2MSFTNGP09.phx.gbl...
App.config is generally read only anyways. (right?) And shared by all
users.

If you had VS 2005/VB.NET there is a new My.Settings which supports this
out of the box. (cool!)

Otherwise there is a lot of options. The simplest (for me) was to save
all settings in a class and just serialize it to disk as an .xml file in
the user's profile directory.

I've am currently using the approach described here:
http://msdn.microsoft.com/library/de...et07082003.asp

Greg

<sh****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Ok I guess I had some misconceptions about the App.config file. What am
I "supposed" to store in this file if not user options and things like
that?

Suppose I just want to remember user settings. What is the "best" way
of doing this with C# .NET? Just come up with my own format and
manually parse my file?


Dec 25 '05 #7
Greg Burns wrote:
http://www.vb2themax.com/ShowContent...a-04c861fac4a5

(Thank m.posseth for link)


I used this approach a long time ago, but gave up after a while. The
problem is that it is re-inventing the wheel, the code essentially loads
an XML file, parses it for data which it then stores in memory. When you
access data you do so through the in-memory collection, when you want to
save values the XML file is written item by item.

It is far simpler to use the XmlSerializer class. The simplest way to do
this is:

1) create an XML class with example data that you want serialized
2) use xsd to create a schema file
3) use xsd to generate a code file from the schema.

the class can then be serialized and deserialized with XmlSerializer.

This does mean that you need to have a fixed schema for the
configuration, but this can be thought of as an advantage. After all,
your code will be written to expect only fixed configuration settings,
and so your code will only work with that version.
I've am currently using the approach described here:
http://msdn.microsoft.com/library/de...et07082003.asp


This is a much better article, in particular the comments about isolated
storage.

Richard
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial:
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Dec 27 '05 #8
an******@gmail.com wrote:
ummm... confusing to your users? they shouldn't be looking at it
anyhow (by default, most of them won't even see the extension in
Windows Explorer).


I think that's a crazy default option - imagine someone who knows how to
use a computer (eg, you) seeing a file list like this:

MyApp
MyApp.exe

In actual fact, the first one is called "MyApp.exe", and the second one
is a .config file!

(And in addition, it doesn't make people think about what they're
opening - an exe is the same as a txt in their eyes!)
Dec 29 '05 #9
Hi,

I think that's a crazy default option - imagine someone who knows how to
use a computer (eg, you) seeing a file list like this:

MyApp
MyApp.exe

In actual fact, the first one is called "MyApp.exe", and the second one is
a .config file!

(And in addition, it doesn't make people think about what they're
opening - an exe is the same as a txt in their eyes!)


You are forgetting the icon in front of it, they will see the real exe with
the app icon they are used to see and they will see the config file with
either a notepad icon or another not very familiar icon

In the worst case it will only takes them two tries to find out the correct
one

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Dec 29 '05 #10
Ignacio Machin ( .NET/ C# MVP ) wrote:
You are forgetting the icon in front of it, they will see the real exe with
the app icon they are used to see and they will see the config file with
either a notepad icon or another not very familiar icon

In the worst case it will only takes them two tries to find out the correct
one


And if someone (eg. a virus) writes an application called "My CV.exe"
into My Documents, which has a Word icon (since apps can have their own
icons), that's not very secure. The user opens My Docs to see a file
called "My CV" with a word icon. A stupid user isn't going to check the
details, they'll just double click. I just think "hiding" what will
happen when you double-click is a silly idea!
Dec 29 '05 #11
Regular home users actually get confused by extensions... This is why
it's default - Once someone knows about extensions they can easily turn
them on...

this however has gone completely off topic

Danny Tuppeny wrote:
Ignacio Machin ( .NET/ C# MVP ) wrote:
You are forgetting the icon in front of it, they will see the real
exe with the app icon they are used to see and they will see the
config file with either a notepad icon or another not very familiar icon

In the worst case it will only takes them two tries to find out the
correct one

And if someone (eg. a virus) writes an application called "My CV.exe"
into My Documents, which has a Word icon (since apps can have their own
icons), that's not very secure. The user opens My Docs to see a file
called "My CV" with a word icon. A stupid user isn't going to check the
details, they'll just double click. I just think "hiding" what will
happen when you double-click is a silly idea!

Dec 29 '05 #12
Benny Raymond wrote:
Regular home users actually get confused by extensions... This is why
it's default - Once someone knows about extensions they can easily turn
them on...

this however has gone completely off topic


As most things do in here :-)

I personally believe things should be secure (I'd say not being able to
tell the difference between .doc and .exe a security risk!) by default,
and user friendly by option :)

Anyway...
Dec 30 '05 #13

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

Similar topics

3
by: Helen | last post by:
How can I write a file to a mapped drive on a different server, from an ASP.Net application? Thanks Helen
4
by: psb | last post by:
I have a file upload Web page using System.Web.UI.HtmlControls.HtmlInputFile. Anyone have any issues uploading files using MacOS browsers of any sort?? Almost all of them bomb on our server. Is...
0
by: andrea | last post by:
According to the possibility of use custom section that must follow a precise schema, I've implemented my own one. The problem is with the compiler, that when start to debug my application hang up...
7
by: Hans | last post by:
Hello, I have a few questions about the My.Settings user configuration. Is it posible to change the filepath of the my.settings userconfig file ? Is it posible to have different files so i...
4
by: Michel Verhagen | last post by:
Hi, I want to create a DTD in an XML file in memory. The XML file is created using the DOM in C#. I am new to all this, but couldn't find anything about creating DTD's using the DOM (well, I...
0
by: hazz | last post by:
I want to load Service.exe.config into a DataGrid, change the timer interval value from 10000 to 555555, then update the original exe.config. The code below shows the code at step 1 and 2 before...
1
by: herbert | last post by:
I am using a TraceSource object configured via app.config. In order to delete the old file before starting the new trace, I need to obtain the filename from the listener. What am I doing wrong in...
0
by: Steve | last post by:
Hello- Platform: - web server using IIS 6 connecting to UNC share on separate file server - Both servers are Windows 2003 with dotNetFramework 2.0 General: - basic ASP.NET pages work fine...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.