1

I've execute the instruction which locates there

I can get, execute and use .exe file as it shown there.

But when I trying debug this code

using System;
using System.Reflection;
using System.Resources;

namespace Example
{
    public class Example
    {
        public static void Main()
        {
            ResourceManager rm = new ResourceManager("GreetingResources",
                                     typeof(Example).Assembly);
            Console.Write(rm.GetString("prompt"));
            string name = Console.ReadLine();
            Console.WriteLine(rm.GetString("greeting"), name);
            Console.ReadLine();
        }
    }
}

with my GreetingResources.resources file, I get MissingManifestResourceException.

I also choose "Embedded resource" option in GreetingResources.resources file properties, but it doesn't solve my issue.

Alexey
  • 41
  • 4
  • Possible duplicate of [What does MissingManifestResourceException mean and how to fix it?](https://stackoverflow.com/questions/1327692/what-does-missingmanifestresourceexception-mean-and-how-to-fix-it) – KevinLamb May 21 '19 at 17:02
  • Getting the arguments for the ResourceManager constructor correct is quite a bit harder than seems necessary. That's why C# has the Resource Designer so you don't have to get this right. Project > Properties > Resources tab, click "Click here to create one". – Hans Passant May 21 '19 at 17:40

1 Answers1

1

Go to project properties in VS, and see what the 'default namespace' is for the project. Then put that before the resource name, eg.

ResourceManager rm = new ResourceManager("<default namespace>.GreetingResources",
                                 typeof(Example).Assembly);

If the resource file is also under a folder, include that, eg.

ResourceManager rm = new ResourceManager("<default namespace>.<my resource folder>.GreetingResources",
                                 typeof(Example).Assembly);
Jim W
  • 4,866
  • 1
  • 27
  • 43