Set up CI with Travis for .NET Core

为君一笑 提交于 2021-02-11 17:11:49

问题


I'm trying to set up a CI for my .NET Core 3.1 class library. I created an account at https://travis-ci.org/github and selected my repository containing the code for my class library for a CI build.

Travis is successfully watching my master branch for commits, but I cannot get the CI build to succeed.

  • My repository: https://github.com/MintPlayer/MintPlayer.AspNetCore.SitemapXml

  • Target framework: .NET Core 3.1

  • My latest .travis.yml file:

    language: csharp
    mono: none
    dotnet: 3.1.302
    script:
     - dotnet restore
    dist: trusty
    sudo: required
    
  • History of attempted travis.yml files (all failed):

But somehow this always errors, this time with the following output:

  • Clean output:

    docker stop/waiting
    resolvconf stop/waiting
    C# support for Travis-CI is community maintained.
    Please open any issues at https://travis-ci.community/c/languages/37-category and cc @joshua-anderson @akoeplinger @nterry
    Installing .NET Core
    $ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
    $ export DOTNET_CLI_TELEMETRY_OPTOUT=1
    E: Unable to locate package dotnet-sdk-3.1
    E: Couldn't find any package by glob 'dotnet-sdk-3.1'
    E: Couldn't find any package by regex 'dotnet-sdk-3.1'
    The command "sudo apt-get install -qq dotnet-sdk-3.1=3.1.302*" failed and exited with 100 during .
    Your build has been stopped.
    
  • Raw output: https://api.travis-ci.org/v3/job/709293291/log.txt

What's wrong with my travis.yml configuration. Why can't I CI test my class library with this config?

I mainly want to CI test for .NET Core. If mono could be included this would be very nice. All the examples you'd find in the git history are also examples that I digged up in other repositories.


回答1:


You are using:

dist: trusty

That's Ubuntu 14.04.6 LTS which is not supported by .NET Core 3.1. Try a newer version of Ubuntu such as bionic.

This is also answered in the travis community post:

dotnet-sdk-3.0 is not available for Trusty (presumably because it’s EOL): https://packages.microsoft.com/ubuntu/14.04/prod/dists/trusty/main/binary-amd64/Packages Move to dist: xenial (which is the default so you can just omit it) or dist: bionic.



来源:https://stackoverflow.com/questions/62960564/set-up-ci-with-travis-for-net-core

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