如何使用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个unittest项目归档我的简单项目,并使用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