I currently have a test class TestClass.cs in C: \ Projects \ TestProject \ TestClass.cs
I also have an Xml file in C: \ Projects \ TestProject \ config \ config.xml
In TestClass.cs, I have a test method for loading Xml from the file system as follows:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Path.Combine(Assembly.GetExecutingAssembly().Location, "config\config.xml"));
Unfortunately, the Location property gives me the value:
C: \ Projects \ TestProject \ TestResults \ klaw_ [computernamehere] [time here] \
instead of what I want is C: \ Projects \ TestProject \
I tried Assembly.GetExecutingAssembly (). CodeBase also with similar results.
Any ideas?
source
share