Skip to content

Conversation

@sliekens
Copy link
Contributor

@sliekens sliekens commented Sep 5, 2025

Resolves #1469

This PR adds official support for installing dotnet prereleases by adding -preview or -daily to the version.

New configuration options

Supported configurations for version, additionalVersions, dotnetRuntimeVersions and aspnetCoreRuntimeVersions:

  • 10.0-preview
  • 10.0-daily

Supported configurations for version and additionalVersions only:

  • 10.0.1xx-preview
  • 10.0.1xx-daily

I believe this change is fully backwards compatible.

Importantly, this syntax will always give you a prerelease version, even if a newer GA version is available. For example, a version spec like "8.0.1xx-preview" gives you a release candidate build of 8.0.0 (8.0.100-rc.2.23502.2) while the latest GA is 8.0.19.

"features": {
    "ghcr.io/devcontainers/features/dotnet:2": {
        "version": "10.0-preview",
        "additionalVersions": "10.0.1xx-daily",
        "dotnetRuntimeVersions": "10.0-daily",
        "aspnetCoreRuntimeVersions": "10.0-daily"
    }
}

High level implementation

  1. Updated the vendor script (dotnet-install.sh) to the latest version from https://dot.net/v1/dotnet-install.sh
  2. Added a function parse_version_and_quality() which converts version specs to a version with a quality
    • "10.0-preview" => "10.0 preview"
    • "10.0-daily" => "10.0 daily"
    • "10.0" => "10.0 GA"
    • "10.0.1xx" => "10.0.1xx GA"
    • "10.0.100" => "10.0.100"
      • (no quality because it is an exact version spec)
  3. read -r is used to split the strings above into variables clean_version and quality
  4. Updated install_sdk and install_runtime to take an optional quality argument and pass it on to the dotnet-install.sh script
  5. Fixed an issue where an empty --channel could be passed to the dotnet-install script (which worked but was certainly weird)
  6. Bumped feature version 2.3.0 to 2.4.0

Tests

For testing, I added two new test scenarios:

  • install_dotnet_preview: tests for 10.0-preview and 10.0.1xx-preview
  • install_dotnet_daily: tests for 10.0-daily and 10.0.1xx-daily

Changes to existing test cases:

  • install_dotnet_multiple_versions: change 10.0-preview to 10.0 to ensure this also still works
  • install_dotnet_multiple_versions_preview: removed because it is now redundant

Documentation

  • Added new configuration option suggestions to devcontainer-feature.json.
  • Added configuration examples to NOTES.md

Remarks

Note that "version": "10.0" currently resolves to a preview version, but this is an implementation detail of the underlying dotnet-install script and the expectation is that it will resolve to a GA build some time in November.

image

@sliekens sliekens requested a review from a team as a code owner September 5, 2025 20:52
@sliekens
Copy link
Contributor Author

sliekens commented Sep 5, 2025

cc @Kaniska244 @eljog @AlvaroRausell

@sliekens
Copy link
Contributor Author

Friendly bump

This is ready for review

Copy link
Contributor

@Kaniska244 Kaniska244 left a comment

Choose a reason for hiding this comment

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

Hello @sliekens ,

Thank you for the contribution. The change looks fine. To be reviewed further by maintainers.

Copy link
Contributor

@AlvaroRausell AlvaroRausell left a comment

Choose a reason for hiding this comment

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

Thanks for the great work!

@AlvaroRausell AlvaroRausell merged commit 572770d into devcontainers:main Sep 16, 2025
12 checks passed
@sliekens sliekens deleted the dotnet-prereleases branch September 16, 2025 18:28
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.

[dotnet] add proper support for preview versions

3 participants