Skip to content

Commit 646fd37

Browse files
Make dotnet tool updates deterministic
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9f7a49d commit 646fd37

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

cli-arguments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
| `--automation unignore-package --manager name --package-id id [--version v]` | Removes an ignored-update rule for a package and refreshes the updates view | 2026.1+ |
4444
| `--automation update-all` | Queues updates for all packages currently shown as upgradable | 2026.1+ |
4545
| `--automation update-manager --manager name` | Queues updates for all packages handled by the specified manager | 2026.1+ |
46-
| `--automation update-package --manager name --package-id id` | Updates a specific package through the automation service and waits for completion | 2026.1+ |
46+
| `--automation update-package --manager name --package-id id [--version v]` | Updates a specific package through the automation service and waits for completion | 2026.1+ |
4747
| `--automation uninstall-package --manager name --package-id id [--scope scope]` | Uninstalls a package through the automation service and waits for completion | 2026.1+ |
4848
| `--background-api-transport {tcp\|named-pipe}` | Selects which local HTTP transport UniGetUI uses for the background API when the app starts | 2026.1+ |
4949
| `--background-api-port port` | Overrides the localhost TCP port used by the background API when `--background-api-transport tcp` is active | 2026.1+ |

src/UniGetUI.PackageEngine.Managers.Dotnet/Helpers/DotNetPkgOperationHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ package.OverridenOptions.Scope is null
5555
);
5656
}
5757

58-
if (operation is OperationType.Install)
58+
if (operation is OperationType.Install or OperationType.Update)
5959
{
6060
if (options.Version != "")
6161
{

testing/automation/run-cli-e2e.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ try {
164164
if ($searchMatch.Count -eq 0) {
165165
throw "search-packages did not return dotnetsay"
166166
}
167+
$latestDotnetsayVersion = $searchMatch[0].version
168+
if ([string]::IsNullOrWhiteSpace($latestDotnetsayVersion)) {
169+
throw "search-packages did not report the latest dotnetsay version"
170+
}
167171

168172
$details = Invoke-CliJson -Arguments @('package-details', '--manager', '.NET Tool', '--package-id', 'dotnetsay')
169173
if ($details.package.id -ne 'dotnetsay') {
@@ -218,7 +222,7 @@ try {
218222
throw "unignore-package did not remove dotnetsay from ignored updates"
219223
}
220224

221-
$update = Invoke-CliJson -Arguments @('update-package', '--manager', '.NET Tool', '--package-id', 'dotnetsay')
225+
$update = Invoke-CliJson -Arguments @('update-package', '--manager', '.NET Tool', '--package-id', 'dotnetsay', '--version', $latestDotnetsayVersion)
222226
if ($update.status -ne 'success') {
223227
throw "update-package failed: $($update | ConvertTo-Json -Depth 8)"
224228
}
@@ -228,7 +232,7 @@ try {
228232
-FailureMessage 'list-installed did not include an updated dotnetsay version after update' `
229233
-Condition {
230234
param($response)
231-
@($response.packages | Where-Object { $_.id -eq 'dotnetsay' -and $_.version -ne '2.1.4' }).Count -gt 0
235+
@($response.packages | Where-Object { $_.id -eq 'dotnetsay' -and $_.version -eq $latestDotnetsayVersion }).Count -gt 0
232236
}
233237
$updatedDotnetsay = @($installedAfterUpdate.packages | Where-Object { $_.id -eq 'dotnetsay' })
234238

0 commit comments

Comments
 (0)