Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Use dotnet tool to find out if a specific tool is installed on an environment
# find if stryker is installed
$list = (dotnet tool list -g)
# echo the list
# $list
$strykerFound = ($list | Where-Object {$_.Split(' ')[0] -eq "dotnet-stryker"})
if ($null -ne $StrykerFound) {
Write-Host "Installing Stryker"
dotnet tool install dotnet-stryker -g
else {
Write-Host "Stryker is already installed"
# stop powershell from reporting an error code
$global:LASTEXITCODE = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment