Embed xml file as ressource file in an exe.

G

Guest

Is it possible to embed an xml file from the solution in a program at compile
time. Alternatively I will paste it in the code on the form

doc.LoadXml( "<root>...a billion zillion lines..</root>");

But It would be great if I could do a trick where an solution/project file
in xml could be embedded and read. Maybe something on the following form:

XmlDocument doc = new XmlDocument()
doc.Load({your great answer})
 
T

Tasos Vogiatzoglou

Add the XML to the project and then in the properties of the object set
the Build Action to "Embedded Resource". You can open it by using
assembly.GetManifestResourceStream("Namespace.path.to.file.file.xml").

The name of the file is the namespace of the file (folder structure) +
it's name.

Regards,
Tasos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top