代码之家  ›  专栏  ›  技术社区  ›  Mech0z

测试未在由Azure Devops编译的aspnet core 3.0测试项目上运行

  •  0
  • Mech0z  · 技术社区  · 6 年前

    我有以下存储库 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" />
    

    我的山药档案是这样的

    - task: VSTest@2
      inputs:
        projects: '**/*/Integrationstest.csproj'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
    

    但当它运行时

    测试运行将使用为框架生成的DLL .NETFramework,版本=v4.0和平台X86。下列DLL不 匹配框架/平台设置。Integrationstest.dll是为 Framework.NETCoreApp,版本=v3.0和平台AnyCPU。

    如何更改yaml文件中的.NET framework?

    0 回复  |  直到 6 年前
        1
  •  1
  •   Ben Smith    6 年前

    不要使用VSTest任务,而是使用DotNetCore任务来运行测试,例如。

    - task: DotNetCoreCLI@2
        inputs:
          command: "test"
          projects: "**/*/Integrationstest.csproj"
        displayName: Run the server-side tests