ber*_*maz 1 c# powershell .net-core dotnet-tool
当您想要更新或安装 dotnet 工具时,您需要显式提供预览版本。它在我们的 DevOps 环境中不起作用,因为我们需要始终使包保持最新(包括预览版本)。没有像--preview
更新/安装最新版本(包括预览版本)这样的参数。如何将 dotnet 工具更新到最新版本(包括预览版本)?
该命令不支持开箱即用dotnet tool
。我希望有一个参数,例如--preview
在更新/安装新软件包时也包含预览版本。但不用担心,有一个解决方法;
以下 PowerShell 脚本获取最新版本的dotnet-ef
工具,包括预览版本。然后运行带有参数的更新命令--version
。
$packageName = "dotnet-ef"
$output = dotnet tool search $packageName --prerelease --take 1
$outputString = ("" + $output)
$indexOfVersionLine = $outputString.IndexOf($packageName)
$latestVersion = $outputString.substring($indexOfVersionLine + $packageName.length).trim().split(" ")[0].trim()
Write-Host "Updating "$packageName" to" $latestVersion
dotnet tool update -g $packageName --version $latestVersion
Run Code Online (Sandbox Code Playgroud)
dotnet-sdk 存储库上有一个针对此要求的活动功能请求 https://github.com/dotnet/sdk/issues/16669
这就是我们在 DevOps 管道中实现它的方式: https://gist.github.com/ebicoglu/177f48f5fad1bcc49645c0939af4ae76#file-update-abp-cli-tools-preview-ps1
归档时间: |
|
查看次数: |
1766 次 |
最近记录: |