运行 64 位 C++ 中的 mstest 测试

Running mstest tests in c++ in 64 bits

我正在使用 64 位库(cuda SDK 等)对库进行单元测试。 我正在尝试使用 cuda-memcheck 进行更深入的诊断,因此我 运行 在命令行上进行测试。

mstest.exe /testcontainer:CubicBSplinesTests.dll /test:RGBSliceDoubleConvert

它失败了,因为它会尝试 运行 32 位。我被推荐使用 "Any CPU" 但在 c++ 项目中没有这样的东西。我怎样才能在这些条件下以 64 位进行测试 运行?

Unable to load the test container 'CubicBSplinesTests.dll' or one of its dependencies. If you build your test project assembly as a 64 bit assembly, it cannot be loaded. When you build your test project assembly, select "Any CPU" for the platform. To run your tests in 64 bit mode on a 64 bit processor, you must change your test settings in the Hosts tab to run your tests in a 32 bit process. Error details: Could not load file or assembly 'file:///project_path\x64\Debug\CubicBSplinesTests.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

正确的命令是:

vstest.console.exe CubicBSplinesTests.dll --tests:RGBSliceDoubleConvert

添加到路径后:C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow

mstest.exe 用于 .net 测试,而非本机 c/c++ 测试。