Describe the bug
DotNet global tool path should be added to path.
I tried to fix it in https://github.com/actions/setup-dotnet however I was suggested to submit a patch for the virtual environments.
See https://github.com/actions/setup-dotnet/pull/70
Area for Triage: .NET Core
Feature:
Virtual environments affected
Expected behavior
after installing a dotnet tool it should be accessible.
dotnet tool install -g gitversion
dotnet gitversion -versiom
5.1.3+Branch.master.Sha.bef8ebc0b62b3ddd0cdafe09b66d68bbfcaf90d5
Actual behavior
See my repro:
https://github.com/casz/setup-dotnet-global-tool-repro
See my fix working for setup-dotnet action:
https://github.com/casz/setup-dotnet-global-tool-repro/blob/testingFix/.github/workflows/ci.yml
dotnet tool install -g gitversion
dotnet gitversion -version
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET Core program, but dotnet-gitversion does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Most likely a .NET Core area rather than Git area 馃槄
cc @bishal-pdmsft @pulkitaggarwl
I can confirm this also affects Linux and Mac environments on Azure Pipeline.
for anyone using GitHub actions and would like a workaround
Use my branch for actions/setup-dotnet
- name: Setup dotnet
uses: casz/setup-dotnet@fix/dotnet-global-tool
with:
dotnet-version: '3.1.100'
I've used the following as a work-around on a Linux worker:
- name: Install SonarCloud scanner
run: |
dotnet tool install --global dotnet-sonarscanner --version 4.8.0
echo "::set-env name=PATH::${PATH}:${HOME}/.dotnet/tools"
@bishal-pdMSFT any word on a fix?
@casz sorry for the delay, we'll look into this as soon as possible.
Why install globally though? Can't you just install local instead?
Because global for dotnet tools means installing into the user's folder $HOME/.dotnet/tools and there by putting the tool on path.
Their windows virtual environment already has dotnet tool on path.
Meaning i can install do things like:
dotnet tool install --global dotnet-format
dotnet format -f .
# formats c# code
dotnet tool install --global gitversion.tool
dotnet gitversion /output buildserver
# calculate next version or tagged version.
dotnet tool install --global codecov.tool
codecov -f codecoverage.xml
# upload coverage
Basically I would like to avoid calling the things needed to install locally.
dotnet new tool-manifest
dotnet tool install gitversion.tool
dotnet tool run gitversion.tool /output buildserver
All the things? It's one an extra parameter during install, and a little extra path in front of the command that launches it.
Is this a convenience thing or a blocker?j
Personally I like it as it creates a nice isolation - especially if you're dealing with multiple versions
It's an unexpected behavior that I would consider blocking or an annoyance having to spent time figuring out why Linux and Mac cannot run tools that I install using --global
Whether I install locally or globally is out of the scope of the issue.
The commands work on Windows virtual environments but not Linux/Mac.
I'd like to preface this is in the context of using GitHub actions and/or Azure pipelines.
Locally on my machine I am using local install for some tools.
Since Mac is not yet open source I hope a similar fix has been added for macOS?
@casz, Yep, we have prepared the same fix for macOS. It is being tested right now. We will keep this issue opened until both fixes are deployed
馃憦 Thanks 鉂わ笍
Hello @casz , unfortunately, adding the "export PATH" command to the .bashrc file didn't solve the issue. We'll continue to work on it.
Hello, @Jetersen
The PATH environment variable has been updated for Ubuntu/macOS images.
Many thanks! 馃憦
Awesome, but could we please change it to _prepend_ the dotnet tools path; i.e.
from:
echo "PATH=${CARGO_HOME}/bin:${PATH}:${DOTNET_TOOLS_HOME}:${PHP_COMPOSER_HOME}" | tee -a /etc/environment
to:
echo "PATH=${CARGO_HOME}/bin:${DOTNET_TOOLS_HOME}:${PATH}:${PHP_COMPOSER_HOME}" | tee -a /etc/environment
And please do the same for Windows.
Most helpful comment
It's an unexpected behavior that I would consider blocking or an annoyance having to spent time figuring out why Linux and Mac cannot run tools that I install using
--globalWhether I install locally or globally is out of the scope of the issue.
The commands work on Windows virtual environments but not Linux/Mac.