dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.73k stars 1.07k forks source link

Feature Request: Install or update to the latest including preview version without providing the version parameter #16669

Open ebicoglu opened 3 years ago

ebicoglu commented 3 years ago

When you want to update or install a dotnet tool you need to explicitly provide the version which doesn't work in our DevOps environment. Add a new parameter like --preview to update/install the latest preview version.

dotnet tool update -g dotnet-ef --preview
dotnet tool install -g dotnet-ef --preview

Otherwise, our DevOps engineer is struggling to parse the output of the dotnet tool search command. We always run the latest dotnet tool including preview versions. This is a must for our own dotnet global tools like Volo.Abp.Cli

See what we are doing to be able to update to the latest preview version of any dotnet tool package:


$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

A related question about this on StackOverflow: https://stackoverflow.com/a/66901668/1767482

dotnet-issue-labeler[bot] commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

dsplaisted commented 3 years ago

@wli3 Did we have another issue covering this?