.net-coretravis-cidotnet-tool

How to use dotnet tool during Travis-CI build?


I'm trying to use dotnet-warp as a global tool in my .NET Core Travis-CI build, because I like the idea of a single executable so much better than a folder full of 75ish files.

I can successfully add the tool and verify there's a tools/dotnet folder in the $PATH...

But the log indicates that because .NET Core has been added recently, I'll need to restart or logout before I can actually use the tool.

Is anyone aware of a way to make this work in the Travis-CI environment?


Solution

  • Ran into the same issue, using the info from the Travis CI Installing Dependencies page and this comment on an issue about it, adding the following following to to my .travis.yml solved the problem:

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

    My build log:

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