[Mono-list] Problem Accessing Embedded Resource
    Jim Orcheson 
    jim at va3hj.ca
       
    Tue Apr 26 07:31:58 EDT 2011
    
    
  
I have created a solution consisting of a main program and two 
libraries. In one of the libraries I have included an XML file as an 
embedded resource. When I try to get a stream to read the XML file, the 
call to Assembly.GetManifestResourceStream returns null. mono version 
2.6.7 is used to build the solution.
See below for further information.
The solution is called hamqsler.
The library project is called QslBureaus, and the XML file is QslBureaus.xml
The properties for QslBureaus.xml are as follows:
Build action - Embed as resource
Copy to output directory - Do not copy
Resource ID - QslBureaus.QslBureaus.xml
Name - QslBureaus.xml
Path - /home/jim/Projects/hamqsler/QslBureaus/QslBureaus.xml
Type - XML document
Relative target path - QslBureaus.xml
Target directory - Program files
All other properties are not set.
Here is the code that attempts to get the Stream:
Assembly assembly = Assembly.GetAssembly(new QslBureau().GetType());
Stream str = 
assembly.GetManifestResourceStream("QslBureaus.QslBureaus.xml");
QslBureau is a class defined in the QslBureaus library.
What is the correct name for the manifest resource? Neither 
QslBureaus.QslBureaus.xml nor hamqsler.QslBureaus.QslBureaus.xml works.
Jim
    
    
More information about the Mono-list
mailing list