-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
2cce3b8
commit 9b65f21
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<# | ||
.SYNOPSIS | ||
Update all dotnet tools installed on the system. | ||
See https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools for dotnet-tools. | ||
.EXAMPLE | ||
# Update Project's dotnet tools | ||
Update-DotnetTools | ||
# Update Global dotnet tools | ||
Update-DotnetTools -Global | ||
#> | ||
function Update-DotnetTools { | ||
param( | ||
[Switch]$Global | ||
) | ||
|
||
$globalSwitch = "" | ||
if ($Global) { | ||
$globalSwitch = "-g" | ||
} | ||
|
||
# $ dotnet tool list -g | ||
# Package Id Version Commands | ||
# --------------------------------------------------- | ||
# dotnet-ildasm 0.12.2 dotnet-ildasm | ||
# unitybuildrunner 3.4.0 UnityBuildRunner | ||
$tools = dotnet tool list $globalSwitch | Select-Object -Skip 2 | ||
# dotnet-ildasm 0.12.2 dotnet-ildasm | ||
# unitybuildrunner 3.4.0 UnityBuildRunner | ||
|
||
foreach ($tool in $tools) { | ||
# dotnet-ildasm 0.12.2 dotnet-ildasm | ||
# 13 | ||
$end = $tool.IndexOf(" ") | ||
# dotnet-ildasm | ||
$toolName = ($tool.Substring(0, $end)).Trim() | ||
dotnet tool update $globalSwitch "$toolName" | ||
} | ||
} |