No default or neutral resource given for 'resource'

折月煮酒 提交于 2019-12-10 13:49:57

问题


I am building a UWP app which supports two languages (en and de). I have created both Resource.resw files and and a testfile.xml which is basically the datasource of my application. If I run the app directly from Visual Studio (DEBUG or RELEASE mode) it's working fine, but once I install it from the store or sideload it to the device via WinAppDeployCmd.exe it does not load the resource from Resources.resw

This is my file structure inside the Strings directory:

I have the link to the testfile specified in the Resources.resw file like this:

Once the app is launched I use a ResourceLoader to retrieve the value of the Testfile key to load the right (en or de) file.

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

During the build process these warnings show up in the output window

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.

Do you have any idea why the resource is not loaded when the app is installed via the store or sideloaded?


回答1:


Set <DefaultLanguage>en</DefaultLanguage> for every .csproj in your solution




回答2:


Open the package manifest for your app, default setting is en-US. Change that to en !



来源:https://stackoverflow.com/questions/35492083/no-default-or-neutral-resource-given-for-resource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!