I've used these two configuration files many times before, but I've never taken the time to fully understand how they really work. As most people do, I understand the basics in how to call WebConfigurationManager.AppSettings["key"]
to get config values.
Here are some questions I came up with:
- What happens when you reference a configuration value within a class library, and the library is part of a bigger solution? Does the app.config need to be copied to the output directory in order for the variables to be found? (I assume yes)
- Can you directly use a configuration value from an app.config in another class library?
- Assuming question 3 is "yes", what happens if there are multiple app.config files from different libraries containing configuration values with the same key?
- What happens when you reference the web.config, but in a class library?
- What happens when you reference the app.config, but in a website or web application project?