C# DLL config file

后端 未结 17 2724
梦毁少年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:08

    if you want to read settings from the DLL's config file but not from the the root applications web.config or app.config use below code to read configuration in the dll.

    var appConfig = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location);
    string dllConfigData = appConfig.AppSettings.Settings["dllConfigData"].Value;
    

提交回复
热议问题