我有我的解决方案,这是建立在Azure DevOps。由于解决方案有单元测试和集成测试,所以我需要进行筛选,以避免总是编辑构建定义。在我的笔记本电脑上,下面的命令运行良好,只执行我需要的测试。
dotnet test project.csproj --filter Category=Unit但是,它在Azure DevOps中失败,包含以下消息。
[command]/usr/bin/dotnet test --filter Category=Unit {...}/{...}.Tests.csproj --configuration Release
No executable found matching command "dotnet-test --filter Category=Unit"
##[error]Error: /usr/bin/dotnet failed with return code: 1测试项目有以下nuget包:
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.6.0" />
<PackageReference Include="FluentValidation" Version="8.2.3" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.analyzers" Version="0.10.0" />
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>构建设置:

发布于 2019-04-16 07:02:53
您不需要自定义命令,只需将Command字段更新为Test并将用于筛选的参数标志移动到Arguments

https://stackoverflow.com/questions/55701535
复制相似问题