Reputation: 107
I am trying to load an xml file in windows app and not able to do it.
The actual path of the file is C:\Users\Desktop\Apps\Panel\Panel\Info.xml
and when I try to get them using the below mentioned code, it gives this error Additional information: Could not find file 'C:\Users\Desktop\Apps\Panel\Panel\bin\Debug\Info.xml'.
XDocument doc = XDocument.Load("Info.xml");
Which means \bin\Debug\
is added to the path additionally. Could anyone tell me how it got added and can be removed.
Upvotes: 0
Views: 861
Reputation: 18127
This is because the file is located in your project, not in your Debug directory. Write it this way.
XDocument doc = XDocument.Load("../../UserLoginInfo.xml");
If you want to work your way click properties on UserLoginInfo.xml
in your project and select Copy to output directory
\bin\Debug\ is added because this is the directory where your app is started.
Upvotes: 2