【问题标题】:PCLAppConfig System.IO.FileNotFoundExceptionPCLAppConfig System.IO.FileNotFoundException
【发布时间】:2018-11-23 12:28:21
【问题描述】:

我正在构建一个 Xamarin 表单项目,并在平台特定项目中使用 PCLAppConfig 从公共项目中获取应用配置文件。这一直有效,直到最近。在升级到 Visual Studio(15.9.2) 和 iOS OS(High Sierra 10.13.6) 之后,它停止了对 iOS 项目的工作(我觉得这些变化掩盖了真正的原因)。我收到以下错误:

System.IO.FileNotFoundException:路径:/private/var/containers/Bundle/Application/0AC8F626-E2BD-4432-AC13-C761A1C95E1C/DemoApp.iOS.app/DemoApp.iOS.exe.config

在我看来,它似乎找不到 app.config

我的主项目仍然有一个app.config,在 iOS 特定项目中我可以看到一个App.config(带有链接文件符号)。 iOS 特定项目链接的配置是否应该有不同的大小写?

代码

global::Xamarin.Forms.Forms.Init();
ConfigurationManager.Initialise(PCLAppConfig.FileSystemStream.PortableStream.Current);

LoadApplication(new App());

也试过了

Assembly assembly = typeof(App).GetTypeInfo().Assembly;
ConfigurationManager.AppSettings = new ConfigurationManager(assembly.GetManifestResourceStream("DemoApp.App.config"))
LoadApplication(new App());

编辑 - 更多信息

我已经查看了代码库,在这种情况下

PCLAppConfig.FileSystemStream.PortableStream.Current

等价于

System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile

希望这将有助于获得答案

【问题讨论】:

  • 尝试清理并重建整个解决方案,看看它是否有效。你能通过你文件夹中的路径找到config文件吗?
  • 感谢您的建议,我已经数不清自己尝试了多少次了。我什至删除了整个仓库并再次克隆了它

标签: xamarin xamarin.forms xamarin.ios


【解决方案1】:

遇到了同样的问题。

已在1.0.1 中修复。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-04
    • 2013-06-30
    • 1970-01-01
    • 2019-04-15
    • 2017-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多