如何使用 travis-ci 在 linux 上构建和运行单元测试 Visual Studio 2017 ASP.net .NETCoreApp 版本 1.1 [英] How to build and run unit test Visual Studio 2017 ASP.net .NETCoreApp Version 1.1 on linux using travis-ci

查看:23
本文介绍了如何使用 travis-ci 在 linux 上构建和运行单元测试 Visual Studio 2017 ASP.net .NETCoreApp 版本 1.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 travis-ci 上调用 dotnet restore ./solution.sln 时出现错误.

I get an error when dotnet restore ./solution.sln is called on travis-ci.

错误 MSB4019:未找到导入的项目/usr/share/dotnet/sdk/1.0.4/Sdks/Microsoft.Docker.Sdk/Sdk/Sdk.props".

error MSB4019: The imported project "/usr/share/dotnet/sdk/1.0.4/Sdks/Microsoft.Docker.Sdk/Sdk/Sdk.props" was not found.

我的.travis.yml

language: csharp
dotnet: 1.0.4
mono: none
dist: trusty
env: DOTNETCORE=1  # optional, can be used to take different code paths in    your script

install:
    - dotnet restore ./solution.sln --verbosity detailed

script:
    - dotnet test --configuration Release --verbosity detailed

我该如何解决?

推荐答案

在对本地 ubuntu 机器进行相同研究后,我解决了 :)

After same research on a local ubuntu machine, i worked it out :)

使用 .travis.yml 文件,我的简单项目和 2 个单元测试项目使用 travis-ci 构建并运行所有单元测试.

with that .travis.yml file my simple projects with 2 unittest projects build and runs all unit tests fine using travis-ci.

language: csharp
dotnet: 1.0.4
mono: none # is not needed
dist: trusty # Ubuntu 14.04.5 image
env: DOTNETCORE=1  # optional, can be used to take different code paths in your script
addons:  
 apt:
   packages:
   - libcurl3 # needed for 'dotnet restore'

install:
   - dotnet restore ./solution.sln

script:
#    - dotnet build ./solution.sln --configuration Release
    - find . -name *.xUnitTests.csproj -exec dotnet test {} --configuration Release ; # build and run xunit tests

这篇关于如何使用 travis-ci 在 linux 上构建和运行单元测试 Visual Studio 2017 ASP.net .NETCoreApp 版本 1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆