Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.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
C# MSTest.exe发出程序集或模块未找到警告_C#_Visual Studio_Unit Testing_Dll_Mstest - Fatal编程技术网

C# MSTest.exe发出程序集或模块未找到警告

C# MSTest.exe发出程序集或模块未找到警告,c#,visual-studio,unit-testing,dll,mstest,C#,Visual Studio,Unit Testing,Dll,Mstest,我有一个Visual Studio 2012解决方案,其中包含一个C#项目和一个引用C#项目输出的测试项目。测试项目在VisualStudio中运行良好 但是如果我在开发者命令提示符下使用MSTest.exe运行它: MSTest.exe/testcontainer:mytest.dll 它无法发出许多警告,如: 测试运行部署问题:程序集或模块 “Microsoft.SharePoint.Search.Extended.Query”直接或间接 找不到测试容器引用的“(mytest.dll的路径)

我有一个Visual Studio 2012解决方案,其中包含一个C#项目和一个引用C#项目输出的测试项目。测试项目在VisualStudio中运行良好

但是如果我在开发者命令提示符下使用MSTest.exe运行它:

MSTest.exe/testcontainer:mytest.dll

它无法发出许多警告,如:

测试运行部署问题:程序集或模块 “Microsoft.SharePoint.Search.Extended.Query”直接或间接 找不到测试容器引用的“(mytest.dll的路径)”

我不认为VisualStudio正在复制引用的DLL,这些DLL不是解决方案的一部分

解决这个问题的办法是什么?如何使用MSTest.exe运行测试套件

  • 您可以从GAC引用程序集
  • 在使用测试方法上的
    DeploymentItemAttribute
    运行测试之前,您可以指定应在编译的测试程序集旁边部署哪些文件
    谢谢你,亚历克斯。但是你能详细说明第二点吗。由于我缺少很多引用,我无法对每个引用进行GAC。如果有兴趣,我遇到了一个问题,没有找到特定程序集,对此问题的公认答案帮助我解决了它:。我遇到了一个类似的问题,在这里得到了解决方案:他建议使用vstest.console.exe而不是mstest.exe,这对我很有效!我想知道,如果找不到程序集或模块,它怎么可能是一个警告。这不应该是一个错误吗?