gpt4 book ai didi

c# - 没有为 'resource' 提供默认或中性资源

转载 作者:太空狗 更新时间:2023-10-29 23:06:13 27 4
gpt4 key购买 nike

我正在构建一个支持两种语言(英语和德语)的 UWP 应用程序。我创建了 Resource.resw 文件和一个 testfile.xml,它基本上是我的应用程序的数据源。如果我直接从 Visual Studio(DEBUGRELEASE 模式)运行应用程序,它工作正常,但是一旦我从商店安装它或通过 将它加载到设备>WinAppDeployCmd.exe 它不会从 Resources.resw

加载资源

这是我在 Strings 目录中的文件结构:

strings folder

我有指向 Resources.resw 文件中指定的测试文件的链接,如下所示: resources.resw

应用程序启动后,我使用 ResourceLoader 检索 Testfile 键的值以加载正确的(en 或 de)文件。

var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
var value = loader.GetString("Testfile");
var testfile = Path.Combine(Package.Current.InstalledLocation.Path + "/Strings/", value);

在构建过程中,这些警告显示在输出窗口中

MakePRI : warning 0xdef01051: No default or neutral resource given for 'Files/Project/Strings/testfile_de.xml'. The application may throw an exception for certain user configurations when retrieving the resources.
MakePRI : warning 0xdef00522: Resources found for language(s) 'en,de' but no resources found for default language(s): 'en-US'. Change the default language or qualify resources with the default language.

您知道为什么在通过商店或旁加载应用时没有加载资源吗?

最佳答案

设置<DefaultLanguage>en</DefaultLanguage>对于每个 .csproj在你的解决方案中

关于c# - 没有为 'resource' 提供默认或中性资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35492083/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com