C#.NET Compiling the settings.settings file from various projects in a solution into 1 config file
I have a Solution where one project is the business layer and the other project is the web front-end, which has the BL project as a reference. They each have their own settings.settings file, but at build time the BL config file is not copied into the bin directory. The way we have gotten around this before is just to copy all the settings in the BL app.config into the Web's web.config file. But this seems like an imperfect solution.
Extra Info: The web project does not need to access the BL's config file, but the BL's dll needs to be able to.
Questions: Is there a way to have the referenced projects config file outputted to the bin directory ,besides adding a file copy in the build event? Is there a way 开发者_如何学编程to compile both of the config files into one file automatically? How do other people manage multiple config files in the same solution?
I think the Business Layer project shouldn't have its own config files. In the Business Layer, one should use Configuration Manager to get the settings. Now if you refer the Business Layer in WebApp, it would pick the values from web.config and if you refer it in Windows/WPF app, it would get the values from app.config.
In your case, I would say not to have the config values in Business Layer, jut put them in the WebApp. Make your Business Layer a Class Library project.
精彩评论