How to run vstest.console.exe targeting the 64-bit platform?
Unit Tests set to target platform x64 were failing to run on DevOps tools (VSTS/TeamCity/Octopus).
[error]Error: None of the provided test containers match the Platform Architecture and .Net Framework settings for the test run.
Platform: X86 .Net Framework: Framework45. Go to http://go.microsoft.com/fwlink/?LinkID=330428 for more details on managing these settings.
Locally it is achieved by setting the tests on Visual Studio to run on x64 as default process. Testtab on VS > Test Settings> Default Process Architecture> x64 When using some DevOps tool, the platform can be specified in the script which runs the vstest.console.exe
There's no advantage to compiling test projects with the 64-bit configuration, unless you are calling code that is only supported on 64-bit. Set the unit tests to run as a 64-bit process. From the Visual Studio menu, choose Test, then choose Processor Architecture for AnyCPU projects. Choose x64 to run the tests as a 64-bit process.
MSTest.exe - You can use the MSTest.exe program to run automated tests in a test assembly from a command line. This is a legacy tool. VSTest.Console.exe - This is the latest offering from Microsoft to run automated unit and coded UI tests from a command line. VSTest.Console.exe is optimized in performance and can be used in place of MSTest.exe.
Runs the tests in an isolated process. This isolation makes the vstest.console.exe process less likely to be stopped on an error in the tests, but tests might run slower. This option makes the vstest.console.exe process use or skip the VSIX extensions installed (if any) in the test run.
Locally it is achieved by setting the tests on Visual Studio to run on x64 as default process.
Test tab on VS > Test Settings > Default Process Architecture > x64
When using some DevOps tool, the platform can be specified in the script which runs the vstest.console.exe
In my case, I'm using Azure DevOps Build Definitions, so I set my VS Test task to
/platform:x64
through a parameter when running vstest.console.exe.
vstest.console.exe "C:\Project\bin\x64\Release\Project.UnitTests.dll" "C:\Project\bin\x64\Release\Project.UnitTests.dll" /platform:x64 /logger:trx
Once it is set, all x64 targeting Unit Tests dlls will execute successfully.
Check if you have vstest.console.exe under C:\ Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Mi crosoft\TestWindow\
Press Enter
Then write -> "C:\ Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Mi crosoft\TestWindow\vstest.console.exe" VerifyExe.dll
Where VerifyExe.dll is the project dll i want to execute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With