我嘗試從配置中加載System.Configuration.Configuration - 存儲在另一個位置(其他磁盤)上的文件。但是我得到以下...問題加載配置
例外: 創建SectionName的配置節處理程序時發生錯誤:無法加載文件或程序集「程序集」或其依賴項之一。
FileStream fileStream = new FileStream(@"c:\fancyFile.xml", FileMode.CreateNew);
fileStream.Write(MyProject.Resources.Resource, 0, MyProject.Resources.Resource.Length);
fileStream.Close();
System.Configuration.ConfigurationFileMap fileMap = new ConfigurationFileMap(@"c:\fancyFile.xml");
MyProject.Configuration conf = MyProject.Configuration.GetConfiguration(@"c:\fancyFile.xml").GetSection("MySection") as MyProject.Configuration;
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="MySection" type="MyProject.Configuration, MyProject" allowLocation="true" allowDefinition="Everywhere" />
</configSections>
<MySection>
但我嘗試加載在相同assmebly。我用更多的資料更新了我的問題。希望您能夠幫助我。 – dknaack