Web.config overrides app.config ... why?

I have two DLLs: one with web.config, the other with app.config

I have moved the connection strings from web.config to app.config so that it can be used by other dlls.

Now, when I call ConfigurationManager.GetSection("SomeSection"), the application searches for web.config, when it should search for app.config. It doesn't make sense why this happens because web.config is in a separate DLL.

Can someone explain this please?

+3
source share
1 answer

app.config for dll will never be used.

app.config for exe is renamed to <Application> .exe.config and exe is used

web.config -/.

, Visual Studio app.config DLL- , , , - - - app.config EXE, web.config -/.

@vikps: , -, - configSource, , . configSource .

configSource , . , (, connectionStrings web.config, )

+7

Source: https://habr.com/ru/post/1748321/


All Articles