azure-devopsmstestazure-pipelinesvstestvstest.console.exe

On Visual Studio Test task v2 I am getting the error: The test source file "...UnitTestFramework.dll" provided was not found


On Azure DevOps I have a build pipeline with a Visual Studio Test task v2: enter image description here

I have the VS.QualityTools.UnitTestFramework nuget package on my solution.

I am getting the following error:

"(...)"D:\a\1\s\packages\VS.QualityTools.UnitTestFramework.15.0.27323.2\lib\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll"
"D:\a\1\s\packages\VS.QualityTools.UnitTestFramework.15.0.27323.2\lib\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll"
/logger:"trx"
/TestAdapterPath:"D:\a\1\s"
/diag:"D:\a_temp\54d6e190-44ec-11e9-ade6-9902b6d394ce.txt"
The test source file "D:\a\1\s\packages\VS.QualityTools.UnitTestFramework.15.0.27323.2\lib\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll" provided was not found."

When I run my tests on Visual Studio on my local machine, it works fine. Do you have any guess why this error is happening?


Solution

  • Based on your build definition display, you are currently using VS Test task v2.

    According to current MS Docs documentation, using this VS Test task v2 means that this version only supports VS 2015, 2017, and 2019 unit test projects. But I strongly suggest that you use this task only for VS 2017 and VS 2019 to create the test projects.

    If you use VS 2017, ensure that you are using VS 2017 15.7.1 or later to create the test project and to have nuget related packages that is compatible with VS 2017 at least Microsoft UnitTestFramework version 15.7.1 or later. Because this version is the initial version that allows you to create unit test projects with PackageReference model, instead of legacy packages.config model.