Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2010 VS2010中的测试项目:错误目录_Visual Studio 2010_Automated Tests - Fatal编程技术网

Visual studio 2010 VS2010中的测试项目:错误目录

Visual studio 2010 VS2010中的测试项目:错误目录,visual-studio-2010,automated-tests,Visual Studio 2010,Automated Tests,我已将测试项目添加到我的解决方案中。我希望我的测试加载放在测试项目中的xml文件。为了找到它,我使用Directory.GetCurrentDirectory,但它返回testresults/out文件夹,其中没有我的xml文件,尽管它具有in-properties Copy-To-output目录。我认为在这种情况下,输出目录与我运行测试时的情况有所不同 但是如何提供将该文件复制到testresults/out中的正确方法呢 谢谢是的,构建系统的out目录与测试结果的out目录不同。使用Ass

我已将测试项目添加到我的解决方案中。我希望我的测试加载放在测试项目中的xml文件。为了找到它,我使用Directory.GetCurrentDirectory,但它返回testresults/out文件夹,其中没有我的xml文件,尽管它具有in-properties Copy-To-output目录。我认为在这种情况下,输出目录与我运行测试时的情况有所不同

但是如何提供将该文件复制到testresults/out中的正确方法呢


谢谢

是的,构建系统的out目录与测试结果的out目录不同。使用Assembly.GetExecutionGassembly.Location获取代码的路径。Path.GetDirectoryName,帮助您找到生成系统将.xml文件复制到的目录。

谢谢大家,但我刚刚解决了这个问题。我需要将此文件添加到“测试项目设置”的“部署”部分中的已部署文件列表中。不要忘记单击“启用部署”复选框。 这样,您就不需要任何属性或目录。只需打开您的文件纯名称,没有任何目录和中提琴