In my C# code, I reference to an XML file \"file.xml\", which is in the same directory as the executable itself, using XmlDocument.
Try to set startup directory for the task. You can set in Task Scheduler.
Select Task -> Right Click -> Properties -> Actions Tab -> Select Action -> Edit -> Start in (optional)