Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

Enables specifying major.minor versions (e.g., "8.0", "10.0") in global.json runtimes, which automatically installs the latest patch for that channel.

Changes

  • InstallDotNetCore.cs: Detect two-part versions and use -channel parameter instead of -version
  • eng/common scripts: Added -channel parameter support to dotnet-install.sh/ps1 and tools.sh/ps1
  • Tests: Added 12 unit tests validating version format detection

Usage

{
  "tools": {
    "runtimes": {
      "aspnetcore": ["8.0", "10.0"]
    }
  }
}

Three-part versions continue to work unchanged.

To double check:

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • securitytools.pkgs.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp /opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature request: Support major.minor in global.json for aspnetcore</issue_title>
<issue_description>

  • This issue is blocking
  • This issue is causing unreasonable pain

There is currently no mechanism such as darc/maestro to automatically keep up to date the version of aspnetcore that is referenced in a global.json. The dotnet/wcf repo has a global.json file that looks similar to the following:

{
  "tools": {
    "dotnet": "10.0.100",
    "runtimes": {
      "aspnetcore": [
        "8.0.22",
        "10.0.1"
      ]
    }
  },
  "sdk": {
    "version": "10.0.100"
  },
  "msbuild-sdks": {
    "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.25615.1",
    "Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.25615.1"
  }
}

It's a manual process to keep updating the aspnetcore version as new releases come out, and as a result often gets missed, sometimes for long durations of time. It would be sufficient for WCF's needs to simply support specifying major.minor for the versions and automatically using the latest version that's available.</issue_description>

Comments on the Issue (you are @copilot in this section)

@akoeplinger This will need some changes in https://github.com/dotnet/arcade/blob/47a8a69721dfea57b82121ac1458d2f5bba6abd2/src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs#L78-L128

We need to detect a two-part version like "8.0" or "10.0" and then pass that to the -channel parameter of the dotnet-install script: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script#options

-Channel|--channel <CHANNEL>

Specifies the source channel for the installation. The possible values are:

STS: The most recent Standard Term Support release.
LTS: The most recent Long Term Support release.
Two-part version in A.B format, representing a specific release (for example, 3.1 or 8.0).
Three-part version in A.B.Cxx format, representing a specific SDK release (for example, 8.0.1xx or 8.0.2xx). Available since the 5.0 release.
The version parameter overrides the channel parameter when any version other than latest is used.
```</body></comment_new>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits December 17, 2025 23:58
- Modified InstallDotNetCore.cs to detect two-part versions (e.g., "8.0", "10.0")
- When a two-part version is detected, use -channel parameter instead of -version
- Added IsTwoPartVersion helper method to validate major.minor format
- Added comprehensive unit tests to validate the new functionality

Co-authored-by: akoeplinger <1376924+akoeplinger@users.noreply.github.com>
- Added -channel parameter support to dotnet-install.sh and dotnet-install.ps1
- Modified tools.sh and tools.ps1 InstallDotNet functions to handle channel parameter
- When channel is specified, use --channel instead of --version for dotnet-install
- Updated logic to skip version-based path checks when using channel parameter

Co-authored-by: akoeplinger <1376924+akoeplinger@users.noreply.github.com>
- Changed Exit to return in InstallDotNet function to properly exit the function instead of terminating the entire PowerShell session
- This ensures proper error handling when a runtime is already installed

Co-authored-by: akoeplinger <1376924+akoeplinger@users.noreply.github.com>
Co-authored-by: akoeplinger <1376924+akoeplinger@users.noreply.github.com>
- Removed accidentally committed .nuget/nuget.exe build artifact
- Added .nuget/nuget.exe to .gitignore to prevent future commits

Co-authored-by: akoeplinger <1376924+akoeplinger@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for major.minor in global.json for aspnetcore Support major.minor version format in global.json runtimes Dec 18, 2025
Copilot AI requested a review from akoeplinger December 18, 2025 00:20
Exit

# When using channel, we can't check for an existing installation by version
# since we don't know which version will be installed
Copy link
Member

Choose a reason for hiding this comment

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

@mconnew would this be a problem for you? it means we'd run dotnet-install.ps1 everytime

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.

Feature request: Support major.minor in global.json for aspnetcore

2 participants