XDocument xmlDoc = XDocument.Load( Path.Combine( AppDomain.CurrentDomain.BaseDirectory, @"Data\customers.xml"));
I assume that the Data directory will be deployed with your application in the same root directory as your EXE. This is generally safe unless shadow copying is involved; for example, when you use NUnit to test this code. (With shadow copying, the assemblies that make up your application are copied to a temporary directory, but files like this are left behind.)
Assuming you are not planning to modify customers.xml after deployment, the safest way to handle this is to embed the file as a resource in your assembly.
Tim robinson
source share