Skip to content

[ci] Use variables to control system .NET SDK installs #22694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 1, 2025

Conversation

pjcollins
Copy link
Member

I noticed the net10.0 branch build was failing during the
"generate and publish BAR manifest" step with:

D:\a\_work\1\s\dotnet\package\common.csproj(151,5): error MSB4062: The "PushToBuildStorage" task could not be loaded from the assembly D:\a\_work\1\s\packages\microsoft.dotnet.build.tasks.feed\10.0.0-beta.25228.101\build\../tools/net/Microsoft.DotNet.Build.Tasks.Feed.dll. Could not load file or assembly 'System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

The Microsoft.DotNet.Build.Tasks.Feed tasks are seemingly now being
built against .NET 10, so we'll need to install .NET 10 to run them.

Variables that represent the current stable and preview versions of .NET
have been added to be used throughout the pipeline. These will now only

I noticed the net10.0 branch build was failing during the
"generate and publish BAR manifest" step with:

    D:\a\_work\1\s\dotnet\package\common.csproj(151,5): error MSB4062: The "PushToBuildStorage" task could not be loaded from the assembly D:\a\_work\1\s\packages\microsoft.dotnet.build.tasks.feed\10.0.0-beta.25228.101\build\../tools/net/Microsoft.DotNet.Build.Tasks.Feed.dll. Could not load file or assembly 'System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

The Microsoft.DotNet.Build.Tasks.Feed tasks are seemingly now being
built against .NET 10, so we'll need to install .NET 10 to run them.

Variables that represent the current stable and preview versions of .NET
have been added to be used throughout the pipeline. These will now only
need to be updated in one place when a new major release comes around.
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates various CI pipeline templates to use variables for specifying .NET SDK versions, allowing centralized control over stable and preview .NET SDK installations.

  • Replaces hard-coded SDK versions (e.g., “9.x”) with variable references in tasks such as UseDotNet@2.
  • Adds variables in the common variables file for stable (9.0) and preview (10.0) .NET SDK versions and adjusts branch matching accordingly.
  • Updates display names and pipeline branch conditions to reflect the new variable-driven approach.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/devops/automation/templates/windows/reserve-mac.yml Updated UseDotNet task to use $(DotNetSdkVersion)
tools/devops/automation/templates/windows/build.yml Updated UseDotNet task to use $(DotNetSdkVersion)
tools/devops/automation/templates/variables/common.yml Introduced DotNetSdkVersion (stable) and DotNetPreviewSdkVersion (preview) variables
tools/devops/automation/templates/tests/build.yml Updated UseDotNet task to use $(DotNetSdkVersion)
tools/devops/automation/templates/release/vs-insertion-prep.yml Updated task displayName and SDK version input for preview installs
tools/devops/automation/templates/main-stage.yml Replaced explicit branch names with variable-based names for SDK versions
tools/devops/automation/templates/mac/build.yml Updated UseDotNet task to use $(DotNetSdkVersion)
eng/common/core-templates/job/source-index-stage1.yml Updated displayName and SDK version input from hard-coded 8.x to variable-driven version
Comments suppressed due to low confidence (2)

eng/common/core-templates/job/source-index-stage1.yml:52

  • The display name has changed from 'Use .NET 8 SDK' to use the variable $(DotNetSdkVersion) (currently 9.0). Please verify this change was intentional and that all dependencies relying on .NET 8 are updated accordingly.
displayName: Use .NET $(DotNetSdkVersion) SDK

tools/devops/automation/templates/main-stage.yml:118

  • Using variable substitution in branch comparison strings may not resolve as expected. Please confirm that the resulting branch names (e.g., 'refs/heads/net9.0') match the intended branch naming conventions.
eq(variables['Build.SourceBranch'], 'refs/heads/net$(DotNetSdkVersion)')

@pjcollins
Copy link
Member Author

pjcollins commented Apr 29, 2025

@rolfbjarne this should fix the .NET 10 builds and allow #22660 to build completely again. I figured it would be best to put it on main first, hopefully CI cooperates.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

value: 9.0

- name: DotNetPreviewSdkVersion
value: 10.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the .NET 10 preview in the stable .NET 9 branch? If not, I think this should be 9.0 in .NET 9 branch(es) and then bumped to .NET 10 in net10.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing explicitly needs it. I kept this at 10.0 so that it can be used in the list of branch triggers in main-stage.yml,
and updated vs-insertion-prep.yml to continue to use the stable version on main instead.

@pjcollins
Copy link
Member Author

This didn't apply cleanly to net10.0 so I've put up a PR for that branch here #22704

@pjcollins pjcollins requested a review from mcumming April 30, 2025 17:28
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #3443e0e] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 3443e0e0732857a0f2a709dd0c37421ccbaa52e5 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #3443e0e] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 3443e0e0732857a0f2a709dd0c37421ccbaa52e5 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

✅ API diff vs stable

.NET ( No breaking changes )

✅ Generator diff

Generator diff is empty

Pipeline on Agent
Hash: 3443e0e0732857a0f2a709dd0c37421ccbaa52e5 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #0ccb7c9] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 0ccb7c980db83e1b4591418aae42844e2dc5d26d [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #0ccb7c9] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 0ccb7c980db83e1b4591418aae42844e2dc5d26d [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #0ccb7c9] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 0ccb7c980db83e1b4591418aae42844e2dc5d26d [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #0ccb7c9] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 0ccb7c980db83e1b4591418aae42844e2dc5d26d [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #0ccb7c9] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 0ccb7c980db83e1b4591418aae42844e2dc5d26d [PR build]

@rolfbjarne rolfbjarne merged commit cbf95ca into main May 1, 2025
13 checks passed
@rolfbjarne rolfbjarne deleted the release-test/use-sdk-vars branch May 1, 2025 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants