feat(ir): add typed builder for UseDotNet@2#1150
Merged
Merged
Conversation
Add `use_dotnet::UseDotNet` builder struct with a `PackageType` enum and
migrate the stringly-typed `dotnet_install_task_step` in
`runtimes/dotnet/extension.rs` from raw `TaskStep::new("UseDotNet@2", …)`
calls to the new typed builder.
The builder supports both .NET installation modes:
- Version spec mode: `UseDotNet::with_version("8.0.x")`
- Global-json mode: `UseDotNet::with_global_json()`
All optional inputs (`packageType`, `workingDirectory`, `installationPath`,
`performMultiLevelLookup`, `failOnStandardError`) are only emitted when
explicitly set; the ADO defaults apply otherwise, keeping generated YAML
minimal. Since the ADO default for `packageType` is `"sdk"`, the migration
stops emitting the now-redundant explicit `packageType: sdk` — two existing
tests that asserted on this explicit input are updated accordingly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jamesadevine
approved these changes
Jun 22, 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
Adds a typed builder struct for
UseDotNet@2to the ado-aw IR, and migrates the stringly-typeddotnet_install_task_stepfactory insrc/runtimes/dotnet/extension.rs.Motivation
Previously, the .NET runtime extension emitted the
UseDotNet@2step via rawTaskStep::new("UseDotNet@2", ...).with_input("packageType", "sdk").with_input(...)calls. This PR introduces a typed builder so required inputs are positional, optional inputs are type-checked, and thePackageTypeconstraint ("sdk"/"runtime") is modelled as an enum rather than a stringly-typed key.Changes
src/compile/ir/tasks/use_dotnet.rs: newUseDotNetbuilder struct withPackageTypeenum, convenience constructors (with_version/with_global_json), typed optional setters, and#[cfg(test)] mod tests(11 unit tests)src/compile/ir/tasks/mod.rs:pub mod use_dotnet;declaration (alphabetical order)src/runtimes/dotnet/extension.rs: migrateddotnet_install_task_stepfrom rawTaskStep::newtoUseDotNet::with_global_json()/UseDotNet::with_version(), addeduse_dotnet::UseDotNetimportsrc/compile/extensions/tests.rs: updated two assertions that expected the now-omitted explicitpackageType: sdk(the ADO default is"sdk", so the typed builder correctly omits it to keep generated YAML minimal)ADO Task Reference
UseDotNet@2https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/use-dotnet-v2-taskversion,packageType(PackageTypeenum),useGlobalJson,workingDirectory,installationPath,performMultiLevelLookup,failOnStandardErrorBuilder modes
Validation
cargo build --all-targetscargo test(2133 tests pass, 0 failed)cargo clippy --all-targets --all-features --workspace -- -D warningsCreated by the ado-task-ir-contributor workflow.
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comspsprodweu4.vssps.visualstudio.comSee Network Configuration for more information.