Build fails due to update of vstest to 17.4.0
I have a successful build on 9 November 2022 and my tests are run by calling the following command:
dotnet test "C:\projects\myproject\BusinessTests\BusinessTests.csproj" --configuration Release --no-build /property:Platform=AnyCPU
Next, in the output I have:
Test run for C:\projects\myproject\BusinessTests\bin\Release\net6.0\BusinessTests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.3.1 (x64)
Today (5 December 2022) I see the command is the same:
dotnet test "C:\projects\myproject\BusinessTests\BusinessTests.csproj" --configuration Release --no-build /property:Platform=AnyCPU
But the output is different for 17.4:
Test run for C:\projects\myproject\BusinessTests\bin\Any CPU\Release\net6.0\BusinessTests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.4.0 (x64)
See how the platform (Any CPU
) has been added to the location where the tool tries to find the DLL? At first I thought it was an issue with the test tool, but whe I run this locally, with the same version, it works fine. Any thoughts on what this could be?
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on 05 Dec, 2022 04:59 PM
Hi Peter,
It's because .NET Core 7.0 is the latest version that comes bundled with VS 2022.
Two ways to fix the tests:
1) To define which .NET SDK version is used when you run .NET CLI commands add
global.json
to the root of your repository with the following contents:2) If you are configuring projects via UI then on "Build" tab of project settings remove "Any CPU" under "Platform" field to have "Project default".
2 Posted by peter.morlion on 05 Dec, 2022 07:16 PM
Thank you, that was indeed the fix.
peter.morlion closed this discussion on 05 Dec, 2022 07:16 PM.