Build fails due to update of vstest to 17.4.0

peter.morlion's Avatar

peter.morlion

05 Dec, 2022 03:52 PM

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?

  1. Support Staff 1 Posted by Feodor Fitsner on 05 Dec, 2022 04:59 PM

    Feodor Fitsner's Avatar

    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:

    {
      "sdk": {
        "version": "6.0.300",
        "rollForward": "latestFeature"
      }
    }
    

    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. 2 Posted by peter.morlion on 05 Dec, 2022 07:16 PM

    peter.morlion's Avatar

    Thank you, that was indeed the fix.

  3. peter.morlion closed this discussion on 05 Dec, 2022 07:16 PM.

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

Recent Discussions

27 Jan, 2023 08:06 PM
27 Jan, 2023 08:05 PM
25 Jan, 2023 03:23 PM
25 Jan, 2023 03:22 PM
23 Jan, 2023 03:29 PM