问题
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