Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.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 2012和native.dll的xUnit Runner 上下文_Dll_Visual Studio 2012_Xunit_Xunit.net - Fatal编程技术网

适用于Visual Studio 2012和native.dll的xUnit Runner 上下文

适用于Visual Studio 2012和native.dll的xUnit Runner 上下文,dll,visual-studio-2012,xunit,xunit.net,Dll,Visual Studio 2012,Xunit,Xunit.net,我是一个使用C#和C++/CLI DLL的应用程序。C++/CLI DLL引用纯C++ +DLL,例如Boost库。 测试被编译到Tests.dll中,它与所有其他二进制文件一起放在$(SolutionDir)\bin\Debug中 问题 尝试使用Visual Studio 2012运行xunit测试失败,错误如下: xUnit.net: Exception discovering tests from C:\Dev\xu-tests\bin\Debug\Tests.dll: > Sys

我是一个使用C#和C++/CLI DLL的应用程序。C++/CLI DLL引用纯C++ +DLL,例如Boost库。 测试被编译到Tests.dll中,它与所有其他二进制文件一起放在$(SolutionDir)\bin\Debug中

问题 尝试使用Visual Studio 2012运行xunit测试失败,错误如下:

xUnit.net: Exception discovering tests from C:\Dev\xu-tests\bin\Debug\Tests.dll: 
> System.IO.FileNotFoundException: Could not load file or assembly 'ManagedCpp.DLL' 
> or one of its dependencies. The specified module could not be found.
> File name: 'ManagedCpp.DLL'
在visual studio之外,我可以通过两种方式重现此问题:

  • 尝试从此目录外运行console runner时

    ..(长路径)…\xunit.console.clr4.exe Debug\Tests.dll

  • 尝试从其安装的目录运行GUI runner时

但是,当我使用控制台访问bin\Debug目录,然后从那里启动控制台或GUI运行程序时,我可以让它工作

这使我相信问题在于VS2012试图运行单元测试,而不是使用bin\Debug目录作为工作目录

问题: 如何将运行xunit的工作目录设置为$(OutDir)(或任何特定目录)