Reputation: 1119
The problem starts with 'dotnet test' command. For some reason, the project with tests can't find a shared library that should be available for it (see a screenshot attached). As you may notice, I'm running the task via Azure DevOps using a custom agent (I think it doesn't really matter). From the logs I realized that the reason it works locally on my machine is that the project I'm talking about is being built in Debug mode in Visual Studio and this is exactly the folder the test project is looking for the library (i.e. \bin\Debug\netstandard2.0\my.dll).
The issue appears when I run 'dotnet test' as a task in the build pipeline in Azure DevOps and the process does not create Debug folder for this exactly project. It's weird, because 'dotnet test' builds solution once again (in the debug mode) and the folder should be generated.
I tried switching the project from 'netstandard2.0' to 'netcoreapp2.2' and adding xunit testing libraries. They're not required in this project but it has started producing Debug folder with compiled libs in it (i.e. \bin\Debug\netcoreapp2.2\my.dll). However, it didn't resolve the issue because the test project still looking for the lib in 'netstandard2.0' folder.
I expect the test projects will be relying on the libs available in Release directory (instead of Debug). Can't get how to achieve this.
Upvotes: 2
Views: 621
Reputation: 3272
You are referencing the DLL in the test project , instead add the reference of the project itself to it.
Upvotes: 1