没有给出"资源"的默认或中性资源

nor*_*r0x 5 c# wpf xaml localization win-universal-app

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

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

字符串文件夹

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

启动应用程序后,我使用a 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);
Run Code Online (Sandbox Code Playgroud)

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

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.
Run Code Online (Sandbox Code Playgroud)

您是否知道为什么在通过商店或侧载安装应用程序时未加载资源?

Alb*_*lli 5

<DefaultLanguage>en</DefaultLanguage>.csproj您的解决方案中的每一个设置


Dep*_*hie 1

打开您的应用程序的包清单,默认设置为 en-US。将其更改为en