0
votes

I created a class to manage resources dynamically derived from ComponentResourceManager:

public class MyResourceManager : ComponentResourceManager
{
    public MyResourceManager(Type _t, Langue _lang) : base(_t)
    {
        if (_lang == Langue.French)
        {
            MainAssembly = Assembly.LoadFile("c:/myCustomFolder/french.dll");
        }
        else
        {
            MainAssembly = Assembly.LoadFile("c:/myCustomFolder/english.dll");
        }
    }
}

When i try to apply the resources to my controls, an exception is raised

public static void UpdateLanguage(Control c, Langue _lang)
{
    MyResourceManager language = new MyResourceManager(c.GetType(), _lang);
    language.ApplyResources(c, c.Name);
}

Exception raised: (when ApplyResources is called)

An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll

Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MyAppName.MyFormName.resources" was correctly embedded or linked into assembly "MyAppName.resources" at compile time, or that all the satellite assemblies required are loadable and fully signed.

Do you have an idea ?

1

1 Answers

0
votes

The most common reason for this is that you have changed the namespace name after a Resourse file has been created or that the Build Action of the resource file is not set to Embedded Resource.