Hi all,< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I am new here and I would like to ask you a question. My experience in using windows forms is not so big, I am coming more from the Web Forms area. Trying to develop a C# Windows Form application I encounter some situations like: how can I use the .exe compiled application together with some resource files at run time To be more explicit, e.g. I have an application that is using an XML file located in the Data directory. In the App.config I set the path to the c:/.../Data/myXMLFile.xml.
Can I include the XML file or any other file in some binary resource files and use it with/or inside the .exe file, without making a path reference to it or setting the path in the configuration file
Thanks a lot in advance!
Gabriel

How to include an extern file within an .exe application?
theRevenge
If it's an XML file and you want to put it into the exe, I assume it's not going to change, so why not store it as a string If you want to be able to change it, and you want to create a dll to distribute it ( so it's never changed by code or the end user, but you may change it ), you could create a dll which returns it via a method or property.
With images, you can select to embed them in your exe, and load them in code from there. XML files do not seem to have this option, I guess because it's trivial to store text in code.
nosajis
Buddythunder
In the resource editor, select "Existing file" from the "Add resource" menu.
You can now access your resource using Properties.Resources.<resource name> in your application.
Best regards,
Johan Stenberg
Joshua Kassab
your solution is also nice
I finnaly implemented something like this:
System.Resources.ResourceManager rm = new System.Resources.ResourceManager("MyLib.MyRes", System.Reflection.Assembly.GetExecutingAssembly());
this.txtXML.Text= rm.GetString("XMLString");
Thank you all !!
Paulo Morgado - MVP
You can store your xml data as a string in a resx file. You can update your application by distributing the satellite assembly.