我有一個用於驗證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 –
謝謝。上述鏈接有所幫助。 –