I'm using a class library in my project. The library contains an embedded resource which I want to use in my project. I tried this code in my program:
var assembly = Assembly.GetExecutingAssembly();
var resourceName = "MyCompany.MyProduct.MyFile.txt";
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string result = reader.ReadToEnd();
}
The problem when running this is, that the stream doesn't find anything. The problem is, that it loads the currrent assembly, which is my main project, not the class library. How can I load the resource from my library, what's the best solution in this case? Thanks a lot.