I have a Windows Form project that saves form fields data into a XML file.
When the form is loaded it loads the XML and bind the data to the fields.
Right now the code for getting the XML file is:
DirectoryInfo di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
string filePath = Path.Combine(di.FullName, "Data.xml");
if (File.Exists(filePath)) {
XmlSerializer xs = new XmlSerializer(typeof(ConfigurationModel));
using(FileStream fs = new FileStream(filePath, FileMode.Open)) {
// This will read the XML from the file and create the new instance
// of CustomerData
model = xs.Deserialize(fs) as ConfigurationModel;
}
}
It works fine in Development but I just packed everything into a Setup file and when I click on the installed icon I get:
So, I guess I have to change the path where the XML is going to be saved.
Any clue?