How to build and run unit test Visual Studio 2017 ASP.net .NETCoreApp Version 1.1 on linux using travis-ci

本秂侑毒 提交于 2019-12-13 17:40:56

问题


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

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

my .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

How can I fix it?


回答1:


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

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


来源:https://stackoverflow.com/questions/44316614/how-to-build-and-run-unit-test-visual-studio-2017-asp-net-netcoreapp-version-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!