changing app.config style

A

active T

I have a simple question.

If I use a app.config file, and I use my own structure instead the
default. My application is not running. The compliation is OK but
running does't work. The problem is the structure of my app.config.
For your information, the application doesn't use the
applicationmanager functions, but a own xml key reader.

Is the error because the an app.config file must be always in the
right format?

by the way, the application is not created by me, i must only re
program it so it will be running. And this was the solution. But in
want to know why.

thnx
 
G

Guest

app.config gets written next to the built executable with the name
<yourexename>.exe.config. The .NET Framework expects the file to be with this
naming convention, and it expects the sections and elements in this xml file
to conform to a standardized schema. If you want to do something "different"
your best bet is to use a separate file with a different naming convention,
and handle your own parsing and reading of the file.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
 
M

Marc Gravell

To expand on Peter's reply; many, many part of the framework will read
optional settings out of app.config; if the file exists, and they [the
multitude of app.config aware classes] attempt to look at their
settings, they are likely to throw exceptions. Notably, Most notably,
SqlConnection checks for trace/performance counter data in app.config,
and is unforgiving (it doesn't gracefully cope with non-standard
data).

That said, as long as you correctly declare your section and stick to
valid xml, then *within* your section you can do what you want. Pack
it all in a single hex-encoded block if you like (or whatever).

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top