I compile my .NET Library, and it creates mylib.dll.config.
But when I modify or even delete this file, it is clearly not being used.
My ASP.NET website has the exact same settings in it anyway, so is it possible to inherit the connection string?
That is, the .NET library inherits its connection string from my ASP.NET app configuration.
I call my settings from my library using:
mylib.Properties.Settings.Default.dbConnString;
or
Properties.Settings.Default.dbConnString;
My website has an identical setting:
myweb.Properties.Settings.Default.dbConnString;
The library is running off its compile time settings. Not the web settings.
At runtime the
mylib.dll.config(created by your class library project) will be ignored and it’s theWeb.configthat will be used.That’s the normal behavior for an asp.net web site.
It means that if you add something into your
.dll.configfile, you’d have to add it to theWeb.configfile as well.See this related question.