从命令行运行本机VS2012 / C ++ 64位单元测试 [英] Running native VS2012/C++ 64-bit unit tests from command line
问题描述
E:\VS Projects\ ... \ C:\程序文件(x86)\Microsoft Visual Studio 11.0 \
Common7\IDE\MSTest.exe/testcontainer:mytest.dll
/ testsettings:E: \VS Projects\ ... \Local.testsettings
最重要的程序响应是:
Microsoft(R)测试执行命令行工具版本11.0.50727.1
版权所有(c)Microsoft Corporation。版权所有。
加载E:\VS Projects\ ... \Local.testsettings ...
载入mytest.dll ...
mytest.dll
无法加载测试容器'mytest.dll'或其
依赖关系之一。如果您将测试项目程序集构建为64位程序集,则
无法加载。构建测试项目程序集时,请为平台选择Any
CPU。要在64位
处理器上以64位模式运行测试,您必须在主机选项卡中更改测试设置,以便在32位进程中运行
测试。错误详细信息:无法加载文件或程序集
'file:/// E:\VS Projects\ ... \mytest.dll'或其依赖项之一。
模块预计包含程序集清单。
Local.testsettings包含信息,测试应在64位环境中运行。 p>
我可以猜到,这个mstest期望一个程序集而不是本机测试项目,这就是为什么它失败。如果是,如何从命令行运行本机测试?在另一种情况下,我应该如何配置mstest正常工作?
感谢Hans Passant的指导。 >
解决方案是使用:
C:\程序文件(x86)\Microsoft Visual Studio 11.0 \ Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
I'm attempting to run unit tests from the command line. I tried using the mstest.exe program using the following command:
E:\VS Projects\...\>"C:\Program Files (x86)\Microsoft Visual Studio 11.0\
Common7\IDE\MSTest.exe" /testcontainer:mytest.dll
/testsettings:"E:\VS Projects\...\Local.testsettings"
The mstest program responce was:
Microsoft (R) Test Execution Command Line Tool Version 11.0.50727.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading E:\VS Projects\...\Local.testsettings...
Loading mytest.dll...
mytest.dll
Unable to load the test container 'mytest.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:///E:\VS Projects\...\mytest.dll' or one of its dependencies. The
module was expected to contain an assembly manifest.
Local.testsettings does include information, that the tests shall be run in 64-bit environment.
I can guess, that mstest expects an assembly instead of native test project and this is why it fails. If so, how can I run native tests from the command line? In the other case, how shall I configure the mstest to work properly?
Thanks for Hans Passant for guidance.
The solution is to use:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
这篇关于从命令行运行本机VS2012 / C ++ 64位单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!