can i use common web.config for solution in dot net?
I am going to develop the web application in asp.net. where as in this application there is 4 user perspectives. all are independent all togather. but I want to develop under the single web solution. also want to create the number web applications for each user perspective, under开发者_如何学JAVA this solution. so can i use common web.config file for this solution? what will impact ? if can not then how to manage the config files so that I need to change configuration at once (if need in future)
Yes, you can use the common web.config file. Config files are hierarchical -- with some caveats that don't concern you now because you will use only one config file. If, in the future, you decide each app needs a slightly different config, then you can create a web.config in each app, containing only the config deltas.
Having said all this, I have never developed an app this way because
- my apps all need a different config
- the common web.config is in a different location than my apps, which makes version control more complicated
Web.config files are "cascading" in nature. Config values in parent folders are applied first. If there are config files in sub folders they will override the parent values where applicable.
Unless you have a high degree of reuse of custom configuration settings it may make more sense to simply copy & paste the values between files on the four projects.
If the configurations really are identical, you could also create a build task to copy a common web.config file into each of the projects.
精彩评论