我有一个 WPF 浏览器应用程序,我试图在其中加载配置文件。
由于应用程序部署为 xbap,它无法访问本地文件系统,因此我需要将配置文件编译为程序集中的资源。
现在,我无法在浏览器应用程序中加载配置文件,因为 ExeConfiguationFileMap 类只采用文件系统路径而不是 Pack URI。
我该如何解决这个问题?
这就是我的代码的样子。
let filemap = new ExeConfigurationFileMap()
filemap.ExeConfigFilename <- (new System.Uri(@"pack://application:,,,/PSAT.PSATResources;component\resources\config\app.config")).LocalPath
TMDBConnection.m_config <- System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(filemap, System.Configuration.ConfigurationUserLevel.None)