My exe’s path is c:\dev\source\project1\bin\debug\app.exe
but my XML file is located at c:\dev\source\project1\file.xml
How can I load the XML file at runtime, right now I have been hard-coding the absolute url, but I don’t want to do it this way.
What happens in the scenario if I change the location or the end-user moves the file to another location, for example, file.xml gets moved to a sub-directory under project1 called sub, would I have to change things again. Is there way to not have to worry about were the file is located?
In your Solution Explorer go to the XML file set
Copy to Output DirectorytoCopy AlwaysorCopy if NewerThis will put a copy of the xml file inc:\dev\source\project1\bin\debug\and have your program reference the version that is in the same folder as the exe.