C
Christofer Dutz
Hi,
I am trying to read a XML-File which I marked as embedded resource from
within the code of my DLL. Unfortunately it doesn't work.
On my search for the error I inserted some code for outputing all
Resources names to a simple textfile. Here nothing is output.
Here my code (a little messy after about 3 hours of debugging):
// Use the LoadXml method to load the XslTransform
// object with the style sheet.
assembly = Assembly.GetCallingAssembly();
// -- Begin -- Debug code
string[] resourceNames = assembly.GetManifestResourceNames();
System.IO.StreamWriter writer =
System.IO.File.CreateText("c:\\TestFile.txt");
writer.WriteLine("Also ... ich hoffe, dass da jetzt gleich was im
Textfile steht ...");
for(int x = 0; x < resourceNames.Length; x++)
{
writer.WriteLine(resourceNames[x]);
}
writer.WriteLine("... Ende");
writer.Close();
// -- End -- Debug code
// Read the Resource and create an XmlDocument from it
s =
assembly.GetManifestResourceStream("syngo.SeSo.Engine.XPathResolver.xslt");
theStylesheet = new XmlDocument();
reader = new StreamReader(s);
theStylesheet.LoadXml(reader.ReadToEnd());
I have no more ideas ... please help me ...
Christofer
I am trying to read a XML-File which I marked as embedded resource from
within the code of my DLL. Unfortunately it doesn't work.
On my search for the error I inserted some code for outputing all
Resources names to a simple textfile. Here nothing is output.
Here my code (a little messy after about 3 hours of debugging):
// Use the LoadXml method to load the XslTransform
// object with the style sheet.
assembly = Assembly.GetCallingAssembly();
// -- Begin -- Debug code
string[] resourceNames = assembly.GetManifestResourceNames();
System.IO.StreamWriter writer =
System.IO.File.CreateText("c:\\TestFile.txt");
writer.WriteLine("Also ... ich hoffe, dass da jetzt gleich was im
Textfile steht ...");
for(int x = 0; x < resourceNames.Length; x++)
{
writer.WriteLine(resourceNames[x]);
}
writer.WriteLine("... Ende");
writer.Close();
// -- End -- Debug code
// Read the Resource and create an XmlDocument from it
s =
assembly.GetManifestResourceStream("syngo.SeSo.Engine.XPathResolver.xslt");
theStylesheet = new XmlDocument();
reader = new StreamReader(s);
theStylesheet.LoadXml(reader.ReadToEnd());
I have no more ideas ... please help me ...
Christofer