-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.ps1
More file actions
29 lines (25 loc) · 1.05 KB
/
install.ps1
File metadata and controls
29 lines (25 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Install script for dotnet-inspect (Windows).
# Usage: irm https://raw.githubusercontent.com/richlander/dotnet-inspect/main/install.ps1 | iex
#
# Installs dotnet-inspect using dotnet-install. If dotnet-install is
# not available, it is installed first via `dotnet tool install -g`.
#
# Requires the .NET SDK.
#
# Environment variables:
# DOTNET_INSTALL_DIR Override the install directory
$ErrorActionPreference = "Stop"
# Ensure dotnet-install is available
if (-not (Get-Command "dotnet-install" -ErrorAction SilentlyContinue)) {
if (-not (Get-Command "dotnet" -ErrorAction SilentlyContinue)) {
Write-Error "dotnet-inspect: error: need 'dotnet' (command not found)"
exit 1
}
Write-Host "dotnet-inspect: dotnet-install not found; installing via dotnet tool..."
dotnet tool install -g dotnet-install
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
Write-Host "dotnet-inspect: installing dotnet-inspect..."
dotnet-install --package dotnet-inspect
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "dotnet-inspect: done"