The error I am getting :
The test source file "D:\a\_work\3\s\MyProject.UnitTests\bin\Release\net6.0\MyProject.UnitTests.dll" provided was not found.
##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
##[warning]No test result files were found.
##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build
Related yml script:
steps:
- task: DotNetCoreCLI@2
displayName: "Run unit tests"
inputs:
command: test
projects: "**/*MyProject.UnitTests/*.csproj"
arguments: --configuration $(projectBuildConfiguration) --no-build --no-restore
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
The tests are running all fine in my local machine. Project build configuration is release
CodePudding user response:
Since you don't have a separate build step you should not be passing the --no-build --no-restore
flags.