In my C# code, I reference to an XML file \"file.xml\", which is in the same directory as the executable itself, using XmlDocument.
I met the same problem, and i tried to print out the various path that .Net sets for the program, here's the result on my machine
AppDomain.CurrentDomain.BaseDirectory:
Directory.GetCurrentDirectory();: C:\Windows\system32
Environment.CurrentDirectory: C:\Windows\system32
so you probably want to use AppDomain.CurrentDomain.BaseDirectory
to locate your file, like this:
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "file.xml");
// use this path to open xml and do your work with it