【问题标题】:How to use dotnet tool during Travis-CI build?如何在 Travis-CI 构建期间使用 dotnet 工具?
【发布时间】:2019-05-17 01:51:20
【问题描述】:

我正在尝试在我的 .NET Core Travis-CI 构建中使用 dotnet-warp 作为全局工具,因为我更喜欢单个可执行文件的想法,而不是一个包含 75 个文件的文件夹。

我可以成功添加工具并验证 $PATH 中有一个 tools/dotnet 文件夹...

但是日志显示因为最近添加了.NET Core,所以我需要重启或注销才能真正使用该工具。

有人知道在 Travis-CI 环境中实现这项工作的方法吗?

【问题讨论】:

    标签: .net-core travis-ci dotnet-tool


    【解决方案1】:

    遇到了同样的问题,使用来自Travis CI Installing Dependencies 页面的信息和this 对有关它的问题发表评论,将以下内容添加到我的 .travis.yml 解决了问题:

    before_script:
      - export PATH=$PATH:/home/travis/.dotnet/tools
    

    我的构建日志:

    $ export PATH=$PATH:/home/travis/.dotnet/tools
    
    $ dotnet tool install -g dotnet-warp
    You can invoke the tool using the following command: dotnet-warp
    Tool 'dotnet-warp' (version '1.0.9') was successfully installed.
    The command "dotnet tool install -g dotnet-warp" exited with 0.
    
    $ cd ./src/[my project]/
    The command "cd ./src/[my project]/" exited with 0.
    
    $ dotnet-warp
    Running Publish...
    Running Pack...
    Saved binary to "[my project]"
    The command "dotnet-warp" exited with 0.
    

    【讨论】:

    • 我已经看过这两个链接,但还不能以一种有效的方式将它们组合在一起。这就像一个魅力 - 谢谢!
    猜你喜欢
    • 1970-01-01
    • 2017-05-05
    • 2015-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-15
    • 2014-12-14
    • 1970-01-01
    相关资源
    最近更新 更多