1
Answer

Referencing an XML File within the Project

Does anyone know how to reference an XML that is stored within my project? The file is used for storing a very small 'database' and program settings. I can get it to work by hard-coding the path, or using the System.Environment.CurrentDirectory member. But I dont think this is satisfactory, because I would like to keep the file with the application, and be able to use it, wherever (in the file system) the program is installed. Simple test: private void Test { string sXmlFile = System.Environment.CurrentDirectory.ToString() + @"\TheXmlFile.xml"; DataSet ds = new DataSet(); ds.ReadXml(sXmlFile); }
Answers (1)