Repository navigation
Default restore to true in sdk-task scripts - #17116
Merged
ViktorHofer merged 7 commits intoJul 14, 2026
Merged
Conversation
sdk-task.ps1/.sh previously defaulted restore to false, diverging from tools.ps1's default of true (which the .ps1 shadowed via its own [switch]). Default restore to true in both scripts and add a -norestore/--norestore opt-out. The -restore/--restore flag is retained as a legacy no-op so existing consumers that pass it don't break. Co-authored-by: Copilot <[email protected]> Copilot-Session: 9e366d06-83fa-487b-898d-dec74a8bea17
JanProvaznik
previously approved these changes
Jul 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Arcade SDK task helper scripts to restore dependencies by default again (matching tools.ps1 behavior), and introduces an explicit opt-out flag so SDK tasks that now rely on PackageReference won’t break when consumers forget to restore.
Changes:
- Default restore behavior to on in
sdk-task.ps1andsdk-task.sh. - Add
-norestore/--norestoreto explicitly skip restore. - Keep
-restore/--restoreas a backward-compatible legacy flag.
Show a summary per file
| File | Description |
|---|---|
| eng/common/sdk-task.sh | Defaults restore to true, updates help text, and adds --norestore parsing. |
| eng/common/sdk-task.ps1 | Defaults restore to true, adds -norestore, and makes restore execution depend on -norestore. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
ViktorHofer
added a commit
to dotnet/msbuild
that referenced
this pull request
Jul 14, 2026
> **Upstreamed:** This change is already submitted upstream to Arcade in dotnet/arcade#17116. Since `eng/common` is mirrored from [dotnet/arcade](https://github.com/dotnet/arcade), this PR applies the same fix directly to msbuild so we don't have to wait for the Arcade flow. ## Summary `sdk-task.ps1`/`sdk-task.sh` defaulted `restore` to **false**, diverging from `tools.ps1`'s default of `true` (the `.ps1` shadowed the `tools.ps1` default via its own `[switch] $restore`, which is always `false` unless passed). This regressed upstream in [dotnet/arcade@ea5fa16](dotnet/arcade@ea5fa16), which flipped the default from restoring-by-default to not restoring. That same commit reworked the SDK tasks to use `PackageReference` items, which means the tasks now need a restore in certain cases - so defaulting `restore` to false leaves those consumers broken. This changes both scripts to default restore to **true** and adds a `-norestore`/`--norestore` opt-out. ## Behavior - `restore` now defaults to **true** in both scripts. - New `-norestore` / `--norestore` flag skips the restore step. - `-restore` / `--restore` is retained as a **legacy no-op** so existing consumers that pass it don't break.
1 task
sdk-task dot-sources tools.ps1/tools.sh, which imports configure-toolset.ps1/sh unless disableConfigureToolsetImport is set. A repo's configure-toolset can call exit and terminate sdk-task before the task runs. sdk-task runs a standalone Arcade SDK task and doesn't need repo-specific toolset setup, so skip the import (consistent with SetupNugetSources). Co-authored-by: Copilot <[email protected]> Copilot-Session: 9e366d06-83fa-487b-898d-dec74a8bea17
The arg loop lowercases each option (lowerI=... | tr [:upper:] [:lower:]) before matching, so the case pattern must be lowercase. --noWarnAsError never matched and was forwarded to MSBuild as a property instead of toggling warn-as-error. Lowercase the pattern to --nowarnaserror. Co-authored-by: Copilot <[email protected]> Copilot-Session: 9e366d06-83fa-487b-898d-dec74a8bea17
The previous 'restore is always on' wording implied --norestore/-norestore was ineffective. Reword help text and inline comments to state restore runs by default and can be skipped with --norestore/-norestore. Co-authored-by: Copilot <[email protected]> Copilot-Session: 9e366d06-83fa-487b-898d-dec74a8bea17
tools.ps1 reads \ at import time to decide whether toolset/SDK acquisition installs. Previously -norestore only skipped the explicit Build 'Restore' call while \ stayed true, so toolset initialization still restored. Set \=\False when -norestore is passed before dot-sourcing tools.ps1, mirroring what sdk-task.sh already does (it sets restore=false before sourcing tools.sh). Co-authored-by: Copilot <[email protected]> Copilot-Session: 9e366d06-83fa-487b-898d-dec74a8bea17
tools.sh's MSBuild helper reads warn_as_error (snake_case), but sdk-task.sh set warnAsError (camelCase, the PowerShell variable name), which was never consumed - so --noWarnAsError had no effect on the build. Rename to warn_as_error so the flag actually disables warnings-as-errors. (sdk-task.ps1 is correct: tools.ps1 consumes \.) Co-authored-by: Copilot <[email protected]> Copilot-Session: 9e366d06-83fa-487b-898d-dec74a8bea17
JanProvaznik
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sdk-task.ps1/sdk-task.shdefaultrestoreto false, diverging fromtools.ps1's default oftrue(the.ps1shadows thetools.ps1default via its own[switch] $restore, which is alwaysfalseunless passed).This regressed in ea5fa16, which flipped the default from restoring-by-default to not restoring. That same commit reworked the SDK tasks to use
PackageReferenceitems, which means the tasks now need a restore in certain cases - so defaultingrestoreto false leaves those consumers broken.This changes both scripts to default restore to true and adds a
-norestore/--norestoreopt-out.Behavior
restorenow defaults to true in both scripts.-norestore/--norestoreflag skips the restore step.-restore/--restoreis retained as a legacy no-op so existing consumers that pass it don't break.