Can I access another project's Embedded Resource from a different project in the same solution?

.net, c#, embedded-resource, visual-studio

Solution

Yes, you can. Here is an example, how you can get the embedded resource `System.Timers.Timer.bmp` inside of the .NET Framework's `System.dll`:

using (Stream stream = typeof(System.Timers.Timer).Assembly.
                           GetManifestResourceStream("System.Timers.Timer.bmp"))
{
    using (Bitmap bitmap = new Bitmap(stream))
    {
        //bitmap.Dump();
    }
}

... or to get the list of the resource names:

string[] names = typeof(System.Timers.Timer).Assembly.GetManifestResourceNames();

... just replace `typeof(System.Timers.Timer)` with a type inside of the assembly containing your embedded resources.

Problem

I have one xml file that stands as an embedded resource in Project_A. And I want to reach this embedded resource from Project_B which references Project_A. (Basically Project_B consists of unit tests and I run them with ReSharper.) Is it possible to access embedded resource of Project_A when I am working on Project_B? Or in general, can I access another project's Embedded Resource from a different project in the same solution?

Original source