473,326 Members | 2,081 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,326 software developers and data experts.

Mulitp app.config files in multiple project solution

Sam
Hi All,

I have a solution which consists of multiple projects and each of these
projects has their own app.config file. The problem is that all of my
projects in the solution pull keys from the app.config file from the main
project (my start-up project). My question is can each project look for its
keys in its own config file first? Is there something or settings that
missing here? Would some one give me a hand?

Regards,

Sam
Jun 23 '06 #1
2 7606
By "a solution which consists of multiple projects" I guess you mean
multiple class libraries. Any App.config file added to a class lib
won't get "built" to the output directory
in the same way that it does when added to a console or windows
application (at least this is true in .net 1.1, I don't know about .net
2.0)

If you want to have multiple config files then you will need to write
custom code for this and make sure that the configuration files get
copied to the right place at build time.

I have done something similar and have used NAnt to rename and copy the
app.config files and then used custom code to read from the xml config
files. However, there is a lot of clever stuff about config files in
..NET 2.0 that might be useful.

Jun 23 '06 #2
Sam
Hi Sam,

Sorry I should have clarified a bit more when I said "a solution which
consists of multiple projects". Your guess is correct. What I thought is
that if I can use each app.config for each of my class lib project, then the
code would look much cleaner and readable. But most importantly, if someone
in development team wants to use this project in the future, he wouldn't
have to spend time look for the keys. Thanks so lot for your help.

Regards,

another Sam
"sam.m.gardiner" <sa************@gmail.com> wrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
By "a solution which consists of multiple projects" I guess you mean
multiple class libraries. Any App.config file added to a class lib
won't get "built" to the output directory
in the same way that it does when added to a console or windows
application (at least this is true in .net 1.1, I don't know about .net
2.0)

If you want to have multiple config files then you will need to write
custom code for this and make sure that the configuration files get
copied to the right place at build time.

I have done something similar and have used NAnt to rename and copy the
app.config files and then used custom code to read from the xml config
files. However, there is a lot of clever stuff about config files in
.NET 2.0 that might be useful.

Jun 23 '06 #3

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

Similar topics

1
by: RK | last post by:
Hi I am working on C# application, where in I may require just one app.config for the C#.NET solution with multiple windows application projects. I know one web.config can be used for multiple...
3
by: Simon | last post by:
Hi everyone, I really need help with the following: It's common in app development to create numerous projects under one solution that as a whole combine to become your final application. For...
2
by: bmcelhany | last post by:
Hi all, I have a solution with 4 projects: a class library, a windows app, a windows service, and an installer project. The class library handles all communication with the database and its...
3
by: lobrys | last post by:
Hi I am building a dotnet 1.1 app, in VB.net ... I would like to have several config files corresponding to multiple envirronment (Database, local Machine, Application, User...) and overloads...
3
by: baylor | last post by:
I'm having a weird bug and wondering if anyone has ever seen this before A Hello World GUI app. Create an app.config. When you build, Studio copies app.config to bin\debug\ and renames it to the...
6
by: Daniel Groh | last post by:
Hi Sirs, Could I use 2 config files in the same solution ? I have 2 projects in my solution (Data - Class Library, MySite - Web Application) But the funcking =/ problem happens because i want the...
5
by: Dica | last post by:
i've followed the instructions i found here about how to add a config file to my applicaiton: http://www.c-sharpcorner.com/Code/2003/Nov/CreateUseConfigFiles.asp the instructions state that i...
5
by: BPearson | last post by:
Hello I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to...
4
by: Bennett Haselton | last post by:
If I add this to my web.config file: <authentication mode="Forms"> <forms name=".ASPXUSERDEMO" loginUrl="login.aspx" protection="All" timeout="60" /> </authentication> I can configure the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.