Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,

I wanna work with resource file by this code in .net Core 5 MVC:

C#
rm = new ResourceManager("Resources.Texts", System.Reflection.Assembly.Load("Resources"));
 ci = Thread.CurrentThread.CurrentCulture;


rm.GetString(name, ci);

My resource name file is "Texts.fa.resx".

This is my config in Startup class:
C#
services.AddLocalization(options => options.ResourcesPath = "ControlPanel/Resources");
    
             services.AddMvc()
                 .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
                 .AddDataAnnotationsLocalization();


But i got this error:

Could not load file or assembly 'Resources, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

My References folder Located here: "rootOfProject/ControlPanel/Resources"

Can everyone help me?

What I have tried:

Also i got this error:

Could not find the resource "Texts.en-US.resources" among the resources "" embedded in the assembly "NasimSys_V12", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name.
Posted
Comments
Jo_vb.net 19-Feb-21 13:09pm    
My VS is in german therefor I do not know how the related context menu item is named in english.

In project explorer right click the resource file, then look for a menu item like "run (or execute) user defined tool".
Click on that item.

Then debug/compile again.
Member 11216770 19-Feb-21 14:29pm    
Could you please send a picture of that item?
Jo_vb.net 19-Feb-21 15:54pm    
Cannot post a picture here.

But this links gives some possible reasons for your issue:
https://stackoverflow.com/questions/2058441/could-not-find-any-resources-appropriate-for-the-specified-culture-or-the-neutra

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900