Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 读取特定的配置文件_C#_App Config - Fatal编程技术网

C# 读取特定的配置文件

C# 读取特定的配置文件,c#,app-config,C#,App Config,我创建了自定义配置类来解析配置部分中的数据。 我的项目是类库,这意味着它创建dll。我找到了检索配置部分的方法: return (ReportServerConfigurationSection)ConfigurationManager.GetSection(sectionGroup + "/" + sectionName); 但这只适用于.exe应用程序。 我想在一些集成测试中使用特定的配置测试我的dll,但我无法从正确的配置中读取 如何读取app.dll.config文件?您可以使用Con

我创建了自定义配置类来解析配置部分中的数据。 我的项目是类库,这意味着它创建dll。我找到了检索配置部分的方法:

return (ReportServerConfigurationSection)ConfigurationManager.GetSection(sectionGroup + "/" + sectionName);
但这只适用于.exe应用程序。 我想在一些集成测试中使用特定的配置测试我的dll,但我无法从正确的配置中读取


如何读取app.dll.config文件?

您可以使用ConfigurationManager的OpenExeConfiguration(字符串)方法:

可能存在的副本