-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor
-
Component/s: dotnet-sdk-plugin
-
None
-
Environment:CentOS 7, .NET SDK Support 1.1.1
Installing and then attempting to use a .NET global tool (e.g., dotnet-reportgenerator-globaltool) with a dynamically installed .NET 5 setup fails. A simple reproduction:
pipeline {
agent {
label 'centos' // this is a label for our CentOS 7 nodes
}
tools {
dotnetsdk '5.0'
}
stages {
stage('Test') {
steps {
sh '''
dotnet tool install dotnet-reportgenerator-globaltool --tool-path .'
reportgenerator -help
'''
}
}
}
}
This results in:
+ dotnet tool update dotnet-reportgenerator-globaltool --tool-path . You can invoke the tool using the following command: reportgenerator Tool 'dotnet-reportgenerator-globaltool' (version '4.8.12') was successfully installed. + ./reportgenerator '-reports:**/*cobertura*.xml' -targetdir:MergedCoverage -reporttypes:Cobertura A fatal error occurred. The required library libhostfxr.so could not be found. ... etc. ...
If I set `DOTNET_ROOT`, it works:
pipeline {
agent {
label 'centos'
}
tools {
dotnetsdk '5.0'
}
stages {
stage('Test') {
steps {
sh '''
export DOTNET_ROOT=\$(dirname \$(realpath \$(which dotnet)))
dotnet tool install dotnet-reportgenerator-globaltool --tool-path .'
reportgenerator -help
'''
}
}
}
}
See https://github.com/dotnet/sdk/issues/12359 for background. It seems that this is an environment variable that this plugin should set when installing a .NET SDK.
- links to