Reputation: 13
I want to load my dic.xml file from the root folder , as now I am giving the full path in my application but i want a file loaded from the root directory.
var doc = XDocument.Load(@"D:\anu notes\FYP\LSC 1\LSC 1\LSC\LSC\dic.xml");
Upvotes: 0
Views: 627
Reputation: 4153
Here is what you need:
var rootFolder = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
var xmlFilePath = rootFolder + @"\dic.xml";
var doc = XDocument.Load(xmlFilePath);
Upvotes: 1