简体   繁体   English

由于Windows操作系统不同,VS2017(vstest.console.exe)运行单元测试失败

[英]Running Unit Tests fails with VS2017 (vstest.console.exe) because the Windows OS is different

I'm trying to run some unit tests from the command line using Visual Studio 2017 and the vstest.console.exe (C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe), The execution completes successfully on Windows 10 OS but it fails on Windows Server 2016 OS . 我正在尝试使用Visual Studio 2017和vstest.console.exe从命令行运行一些单元测试(C:\\ Program Files(x86)\\ Microsoft Visual Studio \\ 2017 \\ Enterprise \\ Common7 \\ IDE \\ CommonExtensions \\ Microsoft \\ TestWindow \\ vstest.console.exe),执行在Windows 10操作系统上成功完成,但在Windows Server 2016操作系统上失败。 Any idea what I could be missing here. 知道我在这里可能会缺少什么。 I'm guessing it's a simple environment variable that is not being set and I'm unable to nail down the same. 我猜这是一个未设置的简单环境变量,我无法确定该变量。 Any help, pointers, support is greatly appreciated from all the experienced VS users out there! 所有经验丰富的VS用户将非常感谢您提供的任何帮助,指示和支持! Thanks! 谢谢!

The error that I notice is 我注意到的错误是

Error Message:
 Failed to set up the execution context to run the test

The machines required the installation of an additional package in VS 2017 for the execution of Unit Tests. 这些机器需要在VS 2017中安装其他软件包才能执行单元测试。 These packages were installed by default with the installation of the .Net Desktop environment earlier but with the latest versions of VS 2017 looks like the auto installation of these packages has been disabled and you need to install them explicitly as additional components. 默认情况下,这些软件包是在.Net Desktop环境的早期版本中默认安装的,但是在VS 2017的最新版本中,这些软件包的自动安装似乎已被禁用,您需要将它们作为其他组件进行显式安装。

Packages required for Unit Tests to work: 单元测试正常运行所需的软件包:

Under Compilers, build tools, and runtimes
Visual C++ 2017 Redistributable Update
VC++ 2017 version 15.8 v14.15 latest v141 tools
VC++ 2017 version 15.7 v14.14 toolset

After the installation of the above packages Unit Tests can execute successfully! 安装上述软件包后,单元测试可以成功执行!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 测试用例在使用 https 的 docker windows 控制台中失败 vstest.console.exe - Test cases are failing vstest.console.exe in docker windows console with https cl.exe-vs2017,在Windows 7上构建的本机应用程序,不能在Windows XP下运行 - cl.exe - vs2017, native app build on Windows 7, not run under Windows XP 无法在带有VS2017的Windows 10上安装Distorm - Can't install distorm on Windows 10 with VS2017 从Java运行.exe会提供不同的控制台输出,然后直接从Windows运行.exe - Running .exe from Java gives different console output then running .exe directly from Windows 如何在 VS2017 上构建的 DotNet 控制台应用程序中处理大数据? - How to handle large data in DotNet console app build on VS2017? 是否可以从VS2015和VS2017中的同一Visual Studio项目中定位Windows和Android? - Is it possible to target Windows and Android from the same Visual Studio project in VS2015 & VS2017? 在Windows PowerShell中运行VS 2017构建工具 - Running VS 2017 Build Tools in Windows PowerShell 使用VS2017增强系统DPI缩放 - Enhanced system DPI scaling with VS2017 Behaviors SDK在Vs2017中不可用 - Behaviors SDK Not available in Vs2017 VS2017中带有“%。* s”的sprintf与wsprintf - sprintf vs. wsprintf in VS2017 with “%.*s”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM