我有一个用于验证XML文件的测试用例。 当使用VS2010和.Net 3.5框架时,下面的代码工作得很好,我可以加载XML文件。我的文件位置是应用程序的源文件夹。XMLDocument.Load()在运行测试项目时不加载文件
XmlDocument doc = new XmlDocument();
try
{
doc.Load("Terms_and_Conditions.xml");
XmlNode node;
XmlElement root = doc.DocumentElement;
//Select and display the value of the element.
node = root.SelectSingleNode(NodeSelection);
return node.InnerText;
}
catch (Exception ex)
{
throw ex;
}
当我在.net 4.6.1运行相同的代码,文件路径解析到 C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Terms_and_Conditions.xml
任何人有一个想法,为什么这个问题与.net 4.6 .1
https://github.com/nunit/nunit/issues/1072 –
谢谢。上述链接有所帮助。 –