Как устранить ошибку [термин «pwsh.exe» не распознается как имя командлета, функции, файла сценария или работающей программы]? - PullRequest
0 голосов
/ 19 декабря 2018

При создании нового конвейера в DevOps Azure для настройки CI для проекта dotnet я настроил следующий скрипт Powershell для автоматизации настройки ядра Dot.Net.

Вот скрипт:

$ErrorActionPreference="Stop"
$ProgressPreference="SilentlyContinue"

# $LocalDotnet is the path to the locally-installed SDK to ensure the
#   correct version of the tools are executed.
$LocalDotnet=""
# $InstallDir and $CliVersion variables can come from options to the
#   script.
$InstallDir = "./cli-tools"
$CliVersion = "1.0.1"

# Test the path provided by $InstallDir to confirm it exists. If it
#   does, it's removed. This is not strictly required, but it's a
#   good way to reset the environment.
if (Test-Path $InstallDir)
{
    rm -Recurse $InstallDir
}
New-Item -Type "directory" -Path $InstallDir

Write-Host "Downloading the CLI installer..."

# Use the Invoke-WebRequest PowerShell cmdlet to obtain the
#   installation script and save it into the installation directory.
Invoke-WebRequest `
    -Uri "https://dot.net/v1/dotnet-install.ps1" `
    -OutFile "$InstallDir/dotnet-install.ps1"

Write-Host "Installing the CLI requested version ($CliVersion) ..."

# Install the SDK of the version specified in $CliVersion into the
#   specified location ($InstallDir).
& $InstallDir/dotnet-install.ps1 -Version $CliVersion `
    -InstallDir $InstallDir

Write-Host "Downloading and installation of the SDK is complete."

# $LocalDotnet holds the path to dotnet.exe for future use by the
#   script.
$LocalDotnet = "$InstallDir/dotnet"

Когда я пытаюсь запустить сборку, я получаю следующую ошибку ..

enter image description here

и ..

enter image description here

Я уже искал в Google информацию о людях, которые сталкиваются с той же проблемой, и о том, как они устраняют неполадки.но, еще не нашел много информации.Форумы Azure Devops тоже не помогают.

...