PalBo
PalBo

Reputation: 2592

vsTest targets wrong .NET version

My Azure DevOps build pipeline has a vsTest task in it. The test is specified in azure-pipelines.yml like so:

- task: VSTest@2
  inputs:
    testSelector: 'testAssemblies'
    arguments: '/Framework:.NETCoreApp,Version=3.0'
    testAssemblyVer2: |
      **\*test*.dll
      !**\*TestAdapter.dll
      !**\obj\**
    searchFolder: '$(System.DefaultWorkingDirectory)'

When running the build pipeline, no tests get run and when looking in the log I find this line: Test run will use DLL(s) built for framework .NETFramework,Version=v4.0 and platform X86. Why does it look for a version different than the one specified in the YAML-file and how can I fix this?

Upvotes: 2

Views: 845

Answers (1)

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32240

One of the users suggests the following approach in the comments section of this page:

You can for example add otherConsoleOptions:/Framework:.NETCoreApp,Version=v3.1 in the task to set command line options for VSTest.exe

Upvotes: 1

Related Questions