I have a config file that I need to load as part of the execution of a dll I am writing.
The problem I am having is that the place I put the dll and config file is not the "current location" when the app is running.
For example, I put the dll and xml file here:
D:Program FilesMicrosoft Team Foundation Server 2010Application TierWeb ServicesinPlugins
But if I try to reference the xml file (in my dll) like this:
XDocument doc = XDocument.Load(@".AggregatorItems.xml")
then .AggregatorItems.xml translates to:
C:windowssystem32inetsrvAggregatorItems.xml
So, I need to find a way (I hope) of knowing where the dll that is currently executing is located. Basically I am looking for this:
XDocument doc = XDocument.Load(CoolDLLClass.CurrentDirectory+@"AggregatorItems.xml")
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…