我有以下存储库 https://github.com/Mech0z/Foosball 在我有以下项目文件的地方,我希望管道中的测试步骤运行
https://github.com/Mech0z/Foosball/blob/master/Integrationstest/Integrationstest.csproj
它有以下包
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
而我的yaml文件是这样的
- task: VSTest@2
inputs:
projects: '**/*/Integrationstest.csproj'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
但是当它运行时我得到
Test run will use DLL(s) built for framework .NETFramework,Version=v4.0 and platform X86. Following DLL(s) do not match framework/platform settings. Integrationstest.dll is built for Framework .NETCoreApp,Version=v3.0 and Platform AnyCPU.
如何更改 yaml 文件中的 .NET 框架?
最佳答案
不使用 VSTest 任务,而是使用 DotNetCore 任务来运行您的测试,例如
- task: DotNetCoreCLI@2
inputs:
command: "test"
projects: "**/*/Integrationstest.csproj"
displayName: Run the server-side tests
关于.net-core - 测试未在 Azure Devops 编译的 aspnet core 3.0 测试项目上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58522954/