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.
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.