Add runtimeIdentifier parameter to Bundler and TargetInfo for RID-based OS/arch detection#126437
Draft
Add runtimeIdentifier parameter to Bundler and TargetInfo for RID-based OS/arch detection#126437
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
…ed OS/arch detection Add a new optional `runtimeIdentifier` parameter to both the `TargetInfo` and `Bundler` constructors. When provided, the runtime identifier string (e.g., "linux-x64", "win-arm64") is parsed to determine the target OS and architecture, eliminating the need for callers to implement their own RID parsing logic. Explicit `os` and `arch` parameters take precedence over RID-derived values. When neither the RID nor explicit parameters are provided, existing behavior (defaulting to the current OS/arch) is preserved. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/080a2b19-6edb-49cd-aa57-3169ae7c998c Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
…iscV64 extension The NETFRAMEWORK Architecture extension already provides LoongArch64, so the #if !NETFRAMEWORK guard was incorrectly excluding it from RID parsing on .NET Framework. Add RiscV64 extension for NETFRAMEWORK parity and remove the conditional compilation from ParseRuntimeIdentifier. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/080a2b19-6edb-49cd-aa57-3169ae7c998c Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove optional OS/arch arguments in Bundler and TargetInfo
Add runtimeIdentifier parameter to Bundler and TargetInfo for RID-based OS/arch detection
Apr 2, 2026
Make the OS and architecture parameters required (non-nullable) in both the TargetInfo and Bundler constructors, removing the previous approach of adding a runtimeIdentifier parameter. - TargetInfo: os and arch are now required positional parameters - Bundler: targetOS and targetArch are now required positional parameters (3rd and 4th, after hostName and outputDir) - Remove ParseRuntimeIdentifier method and HostOS fallback detection - Update all test callers to pass explicit OS/arch values - Keep #nullable enable, RiscV64/LoongArch64 extensions, Version? nullability Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/181f3158-29d6-449a-b597-e998407a7c29 Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
… non-optional Restore the original parameter order (options, targetOS, targetArch) and make all three required. This avoids changing the parameter order which would be more disruptive to callers. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/181f3158-29d6-449a-b597-e998407a7c29 Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
…ameworkVersion non-optional - Add Binaries.CurrentOSPlatform matching the original _hostOS logic (Linux → OSX → FreeBSD → Windows fallback) - Use shared property in both BundlerConsistencyTests and SingleFileTestApp - Make targetFrameworkVersion non-optional on both TargetInfo and Bundler - All callers now pass explicit version (Environment.Version as default) Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/fb0ea73a-20ee-458f-ad6f-9362fdbdb6c7 Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
…getInfo Restore the ?? Environment.Version fallback for FrameworkVersion and remove the #nullable enable directive that was added. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/111adf2b-fa15-47e9-9942-56791bd4bfe9 Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
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.
#nullable enablefrom TargetInfo.csFrameworkVersion = targetFrameworkVersion ?? Environment.Version;in TargetInfo constructor