C# DLL config file

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

    Since the assembly resides in a temporary cache, you should combine the path to get the dll's config:

    var appConfig = ConfigurationManager.OpenExeConfiguration(
        Path.Combine(Environment.CurrentDirectory, Assembly.GetExecutingAssembly().ManifestModule.Name));
    

提交回复
热议问题