如何使用Azure Pipelines设置.Net Core NUnit测试

时间:2019-06-18 17:07:29

标签: .net-core nunit azure-pipelines

我正在尝试使用Azure Pipelines为我的图书馆设置CI。我已经运行了.NET Framework测试,但是.NET Core框架目标抛出了以下错误。

System.IO.FileNotFoundException: Could not load file or assembly 'nunit.framework' or one of its dependencies. The system cannot find the file specified.

似乎出现此错误是由于https://github.com/nunit/nunit/issues/2713#issuecomment-365932475中提到的复制.NET Core依赖项的方式。

我的yml文件的测试部分如下。

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
    vsTestVersion: '16.0'

我的问题是,在.NET Core上使用nunit进行测试时,Azure Pipelines yml文件中应该包含哪些内容?

1 个答案:

答案 0 :(得分:0)

您可以尝试在任务Visual Studio测试之前添加任务Visual Studio Test Platform Installer。任务Visual Studio Test Platform Installer可用于构建或发布管道,以从nuget.org或指定的提要中获取Microsoft测试平台,并将其添加到工具缓存中,并且满足“ vstest”需求,并且可以用于运行测试并使用Visual Studio测试任务收集诊断数据。

Visual Studio Test Platform Installer