I am developing an Universal Windows App on C# in Visual Studio 2017. I am working with xml files for saving data. The problem is that when I try to run the builded app, using the executable file, it just doesn't open. I figured out it might be because of the path declaration of the xml files. That's how I have declared the path to the xml files:
string path = Directory.GetCurrentDirectory() + @"\people2.xml";
XDocument document = XDocument.Load(path);
FileStream fss = new FileStream(path, FileMode.Open, FileAccess.Write);
If I have to change something in the XML file properties please let me know.
You could use the following call that will return the path of your current assembly:
Path.GetDirectoryName(typeof(<SomeTypeInYourAssembly>).GetTypeInfo().Assembly.Location);
This path would be used by your application to save the XML files as well as loading them.
For instance, here is an example the line being called right in the App's constructor. The location variable points to the following folder:
C:...\X.App\bin\Debug\AppX\entrypoint\