I added an XML file as an embedded resource in my class library by using the accessing the project properties in Visual Studio and then Resources | Add Resource | Add Existing File…
I’ve tried to access the file using the following code, but I keep getting a null reference returned. Anyone have any ideas?
var path = Server.MapPath('~/bin/MyAssembly.dll'); var assembly = Assembly.LoadFile(path); var stream = assembly.GetManifestResourceStream('MyNamespace.filename.xml');
The MSDN page for GetManifestResourceStream makes this note:
Have you marked the resource as ‘public’ in your assembly?