This is the expected behavior.
You may have separate configuration files, but you will need to read them manually, the two methods cited by you will capture the information from the Assembly that is being executed.
You can use the method ConfigurationManager.OpenExeConfiguration
to capture an object of the type Configuration
and retrieve data saved on appSettings
his.
Something like:
public string GetAppSetting(Configuration config, string chave)
{
var element = config.AppSettings.Settings[chave];
return element?.Value ?? "";
}
The use would be like this
string configLocal = this.GetType().Assembly.Location;
var config = ConfigurationManager.OpenExeConfiguration(configLocal);
string myValue = GetAppSetting(config, "chave");
And that’s right, this is the expected behavior.
– Jéf Bueno
If a project is shared among several solutions, this project cannot have its own configuration file?
– Alexandre Cavaloti
Yeah, I’m posting an idea for you
– Jéf Bueno
Yes, @LINQ is posting an idea p/ you.
– PauloHDSousa