I am trying to load a resx file in my .net website using:
ResourceManager rm = new ResourceManager( "Project.Resource", Assembly.GetExecutingAssembly() );
The Resource.resx file is in the folder App_LocalResources and is set to be embedded in assembly on build.
When I try to access the resx file using:
rm.GetString( "key" );
or rm.GetString( "key", culture );
I get an error message:
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Project.Resource.resources" was correctly embedded or linked into assembly "Project" at compile time, or that all the satellite assemblies required are loadable and fully signed.
Notice the .resources ... any ideas on what is going on here?
To load .resx into ResourceManager you need specify namespace
var rm = new ResourceManager("Namespace.ResxName", Assembly.GetAssembly());
or you can get ResourceManager for free if set Access Modifier inside Managed Resource Editor to Internal or Public, after that VS will generate ResxName.Designer.cs
var rm = ResxName.ResourceManager;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With