|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Mulitp app.config files in multiple project solutionHi 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 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. 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 Show quoteHide quote "sam.m.gardiner" <sam.m.gardi***@gmail.com> wrote in message news:1151079427.523991.151480@p79g2000cwp.googlegroups.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. >
Question about Datasets and ASP.NET
Type xxx not defined #2 Trying to understand API calls dataadapter and stored procs in design time get first 50 characters Problems with structure in structure and DLL function call in VB.NET Re: Parse text into words? Problems with structure in structure and DLL function call in VB.NET Visual Studion 2003 SP1 when will it be released? Searching a WSS List with VB.Net |
|||||||||||||||||||||||