windowsvisual-studiounit-testingvisual-studio-2017vstest.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. 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! Thanks!

The error that I notice is

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

Solution

  • The machines required the installation of an additional package in VS 2017 for the execution of Unit Tests. 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.

    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!