I managed to get this to work based on the resx constructor file. If you open it and look at the ResourceManager property get attribute, you can simply copy the line to access the same resources.
Full explanation
First of all, you need to open the resource file .designer.cs . This should be in your solution explorer, as in the following image:

Just double-click it to open it, and then scan it (it should be near the top):
internal static global::System.Resources.ResourceManager ResourceManager {
In the get accessory, you should see that it assigns something to the temp variable. In my case, it looked like this:
temp = new global::System.Resources.ResourceManager("Resources.Lang", global::System.Reflection.Assembly.Load("App_GlobalResources"));
So, based on this, I created a ResourceManager in a class that I wanted to use in my class library, for example:
ResourceManager lang = new ResourceManager("Resources.Lang", Assembly.Load("App_GlobalResources"));
Note 1: Remember to add using System.Resources; and using System.Reflection; to the beginning of the file.
Note 2: This does not require adding a link to a web project in the class library.
Then I just call the GetString method in my lang variable to get the resources I need.
For example. lang.GetString("MyErrorMessage") .
It is not as elegant as calling Resources.Lang.MyErrorMessage , but it does its job.
Hope this helps. If you have any questions, write a comment below.
Richard Marskell - Drackir
source share