Repository navigation
Use dotnet package download for toolset initialization - #5909
Conversation
Port of dotnet/arcade#16681. Replaces the MSBuild-based restore in InitializeToolset with 'dotnet package download', adds a reusable DotNet helper function to tools.sh/tools.ps1, and moves SdkTasks to a new 'toolset' folder at the package root with backward compatible fallbacks for the old layout. Co-authored-by: Copilot <[email protected]>
Add logic to update child elements of a JSON object node based on ITaskItem[] with Identity/Value metadata. Refactor path navigation into a shared TryNavigateToObject method, replacing the previous recursive approach. Update Directory.Build.targets to use the new ValuesToUpdate parameter for SourceBuiltSdkOverride items when updating msbuild-sdks entries in global.json files. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR updates the VMR/Arcade toolset initialization flow by replacing the MSBuild-based “restore to discover toolset” approach with dotnet package download, and migrates the Arcade SDK package’s build entrypoints from tools/ to a new toolset/ layout (with compatibility fallbacks). It also modernizes several Arcade toolset projects to use SDK-style + PackageReference/CPM, and extends the VMR UpdateJson task to support batch updates.
Changes:
- Rewrite toolset initialization to use
dotnet package download+ extracttoolset/(fallbacktools/), with newDotNethelpers intools.sh/tools.ps1. - Migrate Arcade SDK package layout from
tools/→toolset/, centralizing task declarations and converting multiple.projfiles to SDK-style with package references. - Enhance
UpdateJsonMSBuild task to supportValuesToUpdatefor batch updates and update repo-project orchestration to apply additional global.json updates and env vars.
Show a summary per file
| File | Description |
|---|---|
| src/windowsdesktop/src/windowsdesktop/src/bundle/Wix.targets | Switch to namespaced Arcade DownloadFile task |
| src/sdk/src/Tasks/sdk-tasks/sdk-tasks.InTree.targets | Normalize UsingTask declarations |
| src/sdk/src/Layout/redist/targets/RestoreLayout.targets | Use namespaced DownloadFile task |
| src/sdk/src/Layout/redist/targets/GenerateMSIs.targets | Use namespaced DownloadFile task |
| src/roslyn/src/Setup/DevDivInsertionFiles/DevDivInsertionFiles.csproj | Add Arcade 11 upgrade TODOs / reorder UsingTask |
| src/roslyn/src/NuGet/VS.Tools.Roslyn.Package/VS.Tools.Roslyn.Package.csproj | Add Arcade 11 upgrade TODO |
| src/roslyn/eng/targets/Imports.targets | Add Arcade 11 upgrade TODO |
| src/roslyn/eng/targets/GeneratePkgDef.targets | Add Arcade 11 upgrade TODO / whitespace cleanup |
| src/roslyn/eng/Publishing.props | Change pr-validation/source-only artifact filtering logic |
| src/nuget-client/eng/dotnet-build/dotnet-build.proj | Point ArcadeDir to toolset/ + Publish target rename |
| src/fsharp/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj | Switch NuGetRepack usage to package reference + explicit task assembly |
| src/aspnetcore/src/Installers/Windows/WindowsHostingBundle/Product.targets | Use namespaced DownloadFile task |
| src/aspnetcore/src/Framework/App.Runtime/src/aspnetcore-runtime.proj | Use namespaced DownloadFile task |
| src/aspnetcore/src/Framework/App.Runtime/src/aspnetcore-runtime-composite.proj | Use namespaced DownloadFile task |
| src/aspnetcore/eng/tools/RepoTasks/RepoTasks.tasks | Remove Arcade DownloadFile UsingTask |
| src/arcade/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs | Treat empty Wix paths as unset |
| src/arcade/src/Microsoft.DotNet.NuGetRepack/tasks/build/Microsoft.DotNet.NuGetRepack.Tasks.props | New props with task assembly + UsingTask |
| src/arcade/src/Microsoft.DotNet.Build.Tasks.VisualStudio/build/Microsoft.DotNet.Build.Tasks.VisualStudio.props | New props with task assembly + UsingTask |
| src/arcade/src/Microsoft.DotNet.Build.Tasks.Installers/build/acquisition/acquire-wix/acquire-wix.proj | Use namespaced DownloadFile task |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.SetupPackage.vsmanproj | Minor target formatting reorder |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.InsertionManifests.targets | Move default GenerateSbom property group |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.IbcTraining.runsettings | Add runsettings template file |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.BuildIbcTrainingSettings.proj | Convert to SDK-style + PackageReference |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.BuildIbcTrainingInputs.targets | Convert to PackageReference |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/VisualStudio.AcquireOptimizationData.targets | Convert to PackageReference |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/TrackPrebuiltUsage.targets | Convert SourceBuild.Tasks to PackageReference |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/Tools.proj | New SDK-style tool restore entrypoint |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/SigningValidation.proj | Convert to CPM PackageReference pattern |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/Sign.props | Use ArcadeSdkSnkDir-based key paths |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/Sign.proj | Convert to SDK-style + PackageReference/PackageDownload |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishToSymbolServers.proj | Convert to CPM PackageReference pattern |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishSignedAssets.proj | Convert to CPM PackageReference pattern |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishBuildAssets.proj | Convert to CPM PackageReference pattern |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/PublishArtifactsInManifest.proj | Convert to CPM PackageReference pattern |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/Publish.proj | Convert to SDK-style + rename Publish→Execute + restore changes |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/InstallDotNetCore.targets | Rely on centralized task imports |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Packages.props | New CPM versions for toolset projs |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.targets | Import Arcade SDK targets for toolset projs |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/Directory.Build.props | Toolset-wide defaults + Arcade SDK import |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/CreateBaselineUpdatePR.proj | Convert to CPM PackageReference pattern |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/BuildReleasePackages.targets | Switch NuGetRepack to PackageReference |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/Build.proj | Convert to SDK-style + update target wiring (Execute) |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/AfterSolutionBuild.proj | Convert to SDK-style shell |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/toolset/AfterSigning.proj | Convert to SDK-style shell |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.VsixBuild.targets | Remove explicit VisualStudio task UsingTask |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/VisualStudio.props | Remove explicit VS build tasks assembly property |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets | Remove explicit UsingTask (centralized) |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj | Delete legacy tools/Tools.proj |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.targets | Use ArcadeSdkSnkDir for key files |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.props | Introduce ArcadeSdkSnkDir property |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Versions.props | Delete legacy versions props |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Directory.Build.props | Delete legacy sdk-tasks Directory.Build.props |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RuntimeIdentifierInference.BeforeNETSdkTargets.targets | Remove explicit _SuppressAllTargets assignment |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryValidation.proj | Remove redundant UsingTask declarations |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/RepositoryInfo.targets | Inline repository validation/license checks via Arcade tasks |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/OptimizationData.targets | Remove redundant UsingTask declarations |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateResxSource.targets | Remove redundant UsingTask declarations |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/GenerateChecksums.targets | Remove redundant UsingTask declarations |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/ExcludeFromBuild.BeforeCommonTargets.targets | Gate NoRestore.targets selection on _NoSuppressRestoreTarget |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/EmptyDisableRestore.targets | New restore-suppression helper targets |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/Empty.targets | Expand “no-op” targets + conditional restore suppression |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/Directory.Build.props | Delete empty Directory.Build.props |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props | Adjust default version properties |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props | Centralize Arcade SDK UsingTask declarations |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/BuildStep.props | Delete legacy BuildStep.props |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.targets | Remove __WriteToolsetLocation + adjust import gating |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/sdk/Sdk.props | Remove _SuppressSdkImports bootstrap logic |
| src/arcade/src/Microsoft.DotNet.Arcade.Sdk/Microsoft.DotNet.Arcade.Sdk.csproj | Pack toolset/ content into NuGet package |
| src/arcade/eng/common/tools.sh | Toolset init via dotnet package download + DotNet helper + new GetSdkTaskProject resolution |
| src/arcade/eng/common/tools.ps1 | Toolset init via dotnet package download + DotNet helper + new GetSdkTaskProject resolution |
| src/arcade/eng/common/sdk-task.sh | Update help text for toolset directory |
| src/arcade/eng/common/sdk-task.ps1 | Update help text for toolset directory |
| repo-projects/Directory.Build.targets | Reorder orchestration deps + UpdateJson batch updates for global.json |
| repo-projects/Directory.Build.props | Export NUGET_CONFIG env var to inner builds |
| eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/UpdateJson.cs | Add ValuesToUpdate + refactor navigation |
| eng/Tools.props | Formatting + source-build restore source behavior adjustments |
| eng/source-build-toolset-init.sh | Prefer toolset/ with tools/ fallback |
| eng/PublishSourceBuild.props | Update AfterTargets Publish→Execute + restore-skip conditions |
| eng/Publishing.props | Add SB RestoreSources override + gate artifact discovery during restore |
| eng/common/tools.sh | Toolset init via dotnet package download + DotNet helper + warnnotaserror gating |
| eng/common/tools.ps1 | Toolset init via dotnet package download + DotNet helper + warnnotaserror gating |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 80/81 changed files
- Comments generated: 2
|
Noticed a regression in downstream workflows. Fixed by #6121. |
The SetFileSignInfoForSourceAsset target used BeforeTargets="Sign", but dotnet#5909 renamed the Sign target to Execute in Arcade's Sign.proj. This caused DoNotUnpack to never be applied to the source tarball, resulting in SignTool unpacking and attempting to sign all files inside it. Fix BeforeTargets to reference Execute so the source tarball is no longer unpacked during signing. Fixes: dotnet/source-build#5551 Co-authored-by: Copilot <[email protected]>
|
This looks like it breaks some arcade scenarios...specifically build promotion |
|
Please share those with me on teams |
Includes dotnet/arcade#16681.
Validation build: https://dev.azure.com/dnceng/internal/_build/results?buildId=2947250&view=results
Summary
Replaces the MSBuild-based restore in
InitializeToolsetwithdotnet package download, adds a reusableDotNethelper function totools.sh/tools.ps1, and migrates the Arcade SDK package layout fromtools/to a newtoolset/folder with backward-compatible fallbacks.Motivation
The previous toolset initialization approach used an MSBuild restore (
/t:__WriteToolsetLocation) to discover and extract the Arcade SDK toolset. This was indirect—it required a special target, a temporary.txtfile for path communication, and_SuppressSdkImportslogic inSdk.props/Sdk.targetsto avoid importing targets during the discovery phase. Replacing it withdotnet package downloadsimplifies the flow and removes several layers of indirection.Changes
New
DotNethelper function (tools.ps1/tools.sh)dotnetcommands with proper error handling, exit code propagation, and CI pipeline integration (Write-PipelineSetResulton failure).ARCADE_BUILD_TOOL_COMMANDenvironment variable for telemetry tracking.Toolset initialization rewrite (
InitializeToolset)MSBuild /t:__WriteToolsetLocationon arestore.projto write the toolset path to a.txtfile, then read that file.dotnet package downloadto fetch the Arcade SDK NuGet package, then copies thetoolset/(ortools/as fallback) content directly to the toolset directory. ReferencesBuild.projdirectly.__WriteToolsetLocationtarget fromSdk.targetsand the_SuppressSdkImportsconditional logic fromSdk.props/Sdk.targets.Arcade SDK package layout migration (
tools/→toolset/)toolset/at the package root now containsBuild.proj,Sign.proj,Publish.proj,Tools.proj,Directory.Build.props,Directory.Build.targets,Directory.Packages.props, and all formerSdkTasks/*.projfiles.BuildStep.props,tools/Directory.Build.props,tools/SdkTasks/Directory.Build.props,tools/SdkTasks/Versions.props,tools/Tools.proj.EmptyDisableRestore.targets(extracted fromEmpty.targetsfor conditional restore suppression).<UsingTask>declarations inBuildTasks.propsinstead of scattering them across individual target files.GetSdkTaskProject()now checks$toolsetDir/$taskName.projfirst (new flat layout), then falls back to$toolsetDir/SdkTasks/$taskName.proj(legacy layout).UpdateJson.csenhancementsValuesToUpdateparameter for batch-updating multiple JSON properties in a single invocation (case-insensitive key matching).TryNavigateToObject()helper replacing the recursiveUpdateAttribute().VMR build orchestration updates (
repo-projects/)DiscoverBuiltSdkOverridesnow runs beforeUpdateGlobalJsonVersions.UpdateJsoninvocations to update the bootstrap Arcade SDK version and source-built SDK overrides.NUGET_CONFIGenvironment variable for misc project builds.Publishing and source-build updates
eng/PublishSourceBuild.props: Changed target dependencies fromAfterTargets="Publish"toAfterTargets="Execute".eng/Publishing.props: AddedRestoreSourcesoverride for source-only builds and a restore-skip condition onDiscoverArtifacts.eng/source-build-toolset-init.sh: Updated path lookup to prefertoolset/withtools/fallback.sdk-task.ps1/sdk-task.sh: Updated help text to referencetoolset directoryinstead ofSdkTasks directory.