I have VS 2008 and csproj project (C# Library).
In properties of project, has an assembly name, and default namespace. Note: each class has a namespace.
Is
I wrote an extension method for Assembly that just finds the resource by its filename within the included resources:
public static Stream GetManifestResourceStreamByFileName(this Assembly assembly, string fileName)
{
var targetName = assembly.GetManifestResourceNames()
.FirstOrDefault(x => x.EndsWith("." + fileName));
return targetName == null ? null : assembly.GetManifestResourceStream(targetName);
}
then you just call like so:
var assembly = Assembly.GetExecutingAssembly(); // or Assembly.GetAssembly(this.GetType()) or whatever
var myResource = assembly.GetManifestResourceStreamByFileName("myResource.jpg");