My application intends to export an xml file, and I am aware of that, the XML file is stored in the bin folder.
The code which handles the xml file path is having an issue at the moment. The code is stored in the MainForm.cs
.
As you can see, the the xml file is located in the blue circle and MainForm.cs is located in the red circle. The full path of the xml file is:
var testFileFullPath = @"C:\Users\Daniel\Desktop\Assignment\WoodStock\WoodStock\bin\Debug\output.xml";
I wrote a if-statement to check if the file exist, as followed:
var existing = (File.Exists(testFileFullPath)) ? "Success" : "Fail";
VS log the result as Success
. However, if I use the relative path as follow:
var testFileRelativePath = @"bin\Debug\output.xml";
and run the if-statement:
var existing = (File.Exists(testFileRelativePath)) ? "Success" : "Fail";
VS log the result as Fail
.
My current working directory (MainForm.cs) is var currentWorkingPath = @"C:\Users\Daniel\Desktop\Assignment\WoodStock\WoodStock\MainForm.cs";
I am not sure if this is a VS bug or any restriction? Any solution? Thanks in advance.