Problem solved by JackJJun-MSFT
see link:
https://learn.microsoft.com/en-us/answers/questions/550786/could-not-find-the-resource-2.html?childToView=552669#comment-552669
Could not find the resource

Hello to all
I have a problem with a sample C # resource program.
Program link: https://learn.microsoft.com/it-it/dotnet/api/system.resources.neutralresourceslanguageattribute?view=net-5.0
I follow all the instructions, I do all the builds, but when I run the program, it crashes with the following error:
System.Resources.MissingManifestResourceException: 'Could not find the resource "ExampleResources.resources" among the resources "" embedded in the assembly "Example", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources
Where is the problem?
Thanks
-
Sergio23 271 Reputation points
2021-09-16T04:50:48.507+00:00
1 additional answer
Sort by: Most helpful
-
Timon Yang-MSFT 9,531 Reputation points
2021-09-09T09:33:45.47+00:00 I reproduced your problem but haven't found a solution yet.
But there is another way to add resources, right click on the project=> Add=> New Item=>Resources File.
Then slightly modify the code in the document:
string[] cultures = { "en-us", "fr-FR" }; Random rnd = new Random(); int index = rnd.Next(0, cultures.Length); Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(cultures[index]); Console.WriteLine("The current culture is {0}", CultureInfo.CurrentUICulture.Name); string grtting = ExampleResources.Greeting; Console.Write("Enter your name: "); string name = Console.ReadLine(); Console.WriteLine("{0} {1}!", grtting, name); Console.ReadKey();
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.