locked
Get value from resx RRS feed

  • Question

  • User-284642143 posted

    I created an App_GlobalResources folder and added relevant resx files for the appropriate country.

    I then add a key and value to the file. All displays on the site as required.

    I am now trying to retrieve the value from this resx file so i have the code

                ResourceManager lang = new ResourceManager("Resource.en-AU",  Assembly.Load("App_GlobalResources"));
                string value = lang.GetString(Key);
                return value;

    but the code crashes on the second line with the error 

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

    I noticed its looking for a .resources file which i dont have but have a resx file - how could i correctly get the value from the appropriate resx file?

    Wednesday, December 13, 2017 9:47 AM

All replies

  • User2103319870 posted

    Check if you have set the Resx file build Action to Embedded Resource.

    Please follow the below steps to check that

    • Right click on resx file
    • Select the Property Option
    • Check if BuildAction has been set to EmbeddedResources, if not change it to EmbeddedResources
    Wednesday, December 13, 2017 4:17 PM