C# DLL config file

后端 未结 17 2362
梦毁少年i
梦毁少年i 2020-11-22 05:05

Im trying to add an app.config file to my DLL, but all attempts have failed.

According to MusicGenesis in \'Putting configuration information in a DLL\' this should

17条回答
  •  名媛妹妹
    2020-11-22 05:34

    When using ConfigurationManager, I'm pretty sure it is loading the process/AppDomain configuration file (app.config / web.config). If you want to load a specific config file, you'll have to specifically ask for that file by name...

    You could try:

    var config = ConfigurationManager.OpenExeConfiguration("foo.dll");
    config.ConnectionStrings. [etc]
    

提交回复
热议问题