locked
Resource file not found RRS feed

  • Question

  • User-963208184 posted

    Hi All,

    I have extended a Class Library project by introducing a Resource file (.resx). From within the resource file editor, I have set the 'Access Modifier' to public, the build action to Resource and copy to Output Directory Always.

    My code expects the Resource file to reside in the same directory as that main Dll. The Resource file after deployment resides in the same directory as the main dll, but when an application that has made reference to the dll and methods, fails stating that it cannot access the resource file.

    supposing the main DLL has a namespace of MyLogger.Common. then

    in the actual code I have:

     var assembly = this.GetType().Assembly;
                var resourceManager = new ResourceManager("MyLogger.Common.ErrorResource", assembly);

    in my Test harness project that is linked to the main project it of course works fine. It's only after deployment that the resx file cannot be found. Any ideas?

    The Error states : Make sure "MyLogger.Common.ErrorResource,resources" was correctly embedded or linked into assembly "MyLogger.Common" at compile time. 

    The Resource file is called ErrorResource.resx it looks as though it's tagging 'resources' on the end during compile for some reason, where do I go to remove this?

    I have ensured that the Assembly has a default Culture and in the above line setting resourceManager, I have changed the second parameter passing the assembly to 'Assembly.GetExecutingAssembly()'.

    I now get a missing manifest error. How do I add a manifest to a projectLibrary?

    All the above errors assume that the resource file is compiled. I dont want my resx file compiled since I want the ability to be able to edit the resx file with a text editor if need be once deployed. It Looks as though I should be using the 'ResXResourceReader' object that is supposed to be available to me in the System.Resources namespace. We are using .Net 4.0 and even though everywhere suggests this object is still available in .Net 4, I do not have it. I have a standard ResourceReader class, but this doesn't read my resource file.

    Monday, July 13, 2015 9:54 AM

Answers

  • User-963208184 posted

    Hi All,

    I have given up trying to circumvent the way in which resource files now work. (i.e. need to be satellite assemblies). I am now just reading them as standard xml files and pulling the details from them that way. This also seems to work fine when deployed.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 14, 2015 12:03 PM