No default or neutral resource given for 'resource'
Asked Answered
A

3

5

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:

strings folder

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

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?

Attalanta answered 18/2, 2016 at 20:46 Comment(1)
change your folder to en-US rather than en as it seems to think thats the defaultSlipslop
I
6

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

Ikey answered 29/5, 2016 at 7:58 Comment(1)
Not every project, just the ones with string resources.Chinch
C
1

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

Compote answered 18/2, 2016 at 21:11 Comment(2)
Thanks for the reply - I have already set en as the default language in my package.appxmanifest.Attalanta
I have the same problem. This didn't change anything.Chinch
C
0

This warning: "No default or neutral resource given...." is, as far as I can tell, caused because of VS gets confused about whether a file or directory name is referring to a language. I was at my wits end with a two identical programs, one of which I could publish on the MS Store and the other was reported as crashing. Both programs were running fine on my computer, a Dell XPS 13 running Windows 11. But one was giving this error while publishing and other was not. The only difference in the two programs were the files they were accessing. In the program that was getting no warnings, the files names started with "TP-" while in the one that was giving warnings, the file names started with "SM-". When I changed the file name from SM- to Sxxxxx- the warnings disappeared! I think SM is the abb for Somalian or something. Try this way instead of trying to set the language etc.

Communalism answered 24/3, 2022 at 0:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.