The Daily Parker

Politics, Weather, Photography, and the Dog

Azure DevOps gotcha upgrading to .NET 5

Also known as: read all error messages carefully.

I've just spent about 90 minutes debugging an Azure DevOps pipeline after upgrading from .NET Core 3.1 to .NET 5 RC2. Everything compiled OK, all tests ran locally, but the Test step of my pipeline failed with this error message:

##[error]Unable to find D:\a\1\s\ProjectName.Tests\bin\Debug\net5.0\ref\ProjectName.Tests.deps.json.
Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk".

The test step had this Test Files configuration:

**\bin\$(BuildConfiguration)\**\*Tests.dll
!**\*TestAdapter.dll
!**\obj\**

I'll save you all the steps I went through to determine that the .NET 5 build step only copied .dlls into the ref folder, without copying anything else (like the dependencies definition file). The solution turned out to be adding one line to the configuration:

**\bin\$(BuildConfiguration)\**\*Tests.dll
!**\ref\**
!**\*TestAdapter.dll
!**\obj\**

Excluding the ref folder fixed it. And I hope this post saves someone else 90 minutes of debugging.

Comments are closed