Skip to content

Support for target runtimes. #72

Closed

Description

@JimBobSquarePants

Looking at the documentation and the code it appears the SDK runtime platform architecture is determined by the architecture of the OS.

It would be very useful for unit testing scenarios to allow specifying whether the x86 or x64 SDK is in use as dotnet test requires the explicit architecture.

Activity

  1. coderpatros commented on Jun 28, 2020

    @coderpatros
    Contributor

    From my looking it is explicitly set to x64

    It's probably a corner case, but it could cause issues if someone is running an x86 self hosted runner.

  2. AaronRobinsonMSFT commented on Dec 9, 2021

    @AaronRobinsonMSFT

    Any thoughts resurrecting the following PR: #152

    I'd like a way to specify the architecture too. I need to test on win-x86 and setting that up is complicated.

  3. linked a pull request that will close this issueAdd a way to force the architecture #338on Jul 3, 2023
  4. baynezy commented on Jan 22, 2025

    @baynezy

    I need to test some code with x86 and so this is a blocker for me.

  5. brantburnett commented on Mar 13, 2025

    @brantburnett

    I have found a workaround I use in my workflows that's not TOO cumbersome. Note that this example assumes Windows for the OS.

    # This must be done before the normal setup-dotnet action to ensure DOTNET_ROOT refers to the 64-bit installation
    - name: Setup .NET x86
      uses: actions/setup-dotnet@v4
      env:
        PROCESSOR_ARCHITECTURE: x86
        DOTNET_INSTALL_DIR: C:\Program Files (x86)\dotnet
      with:
        dotnet-version: 8.0.x
    
    # Copy DOTNET_ROOT from the above step to DOTNET_ROOT(x86), the next step will overwrite DOTNET_ROOT to refer to the 64-bit installation
    - name: Set DOTNET_ROOT(x86)
      shell: pwsh
      run: |
        echo "DOTNET_ROOT(x86)=${env:DOTNET_ROOT}" | Out-File -FilePath $env:GITHUB_ENV -Append
     
    - name: Setup .NET
      uses: actions/setup-dotnet@v4
      with:
        dotnet-version: 8.0.x
  6. Gijsreyn commented on Aug 3, 2025

    @Gijsreyn

    Thanks @brantburnett. Just reached this issue, specifically for building a .NET CLI utility for both x64 and x86.

  7. v-priya-kinthali commented on Feb 26, 2026

    @v-priya-kinthali
    Contributor

    Hello everyone👋,
    Thanks for raising this feature request! We've opened #700 that adds an optional architecture input to support cross-architecture .NET installs. Please feel free to check out the PR for more details. Thank you!

  8. v-priya-kinthali commented on Mar 3, 2026

    @v-priya-kinthali
    Contributor

    Hello everyone👋,
    Support for explicit architecture has been added and PR#700 is now merged. You can now explicitly specify the architecture (e.g., x64, arm64) when installing .NET, enabling cross-architecture installs on the same runner. The changes are available on actions/setup-dotnet@main and will be included in the next release.
    We are now proceeding to close this feature request. If you have any further questions or concerns, or if you encounter related issues after updating, please feel free to reach out to us. Thanks again!

  9. matherm-aboehm commented on Mar 5, 2026

    @matherm-aboehm

    Thanks @priya-kinthali for adding this feature.
    Unfortunately, this does not support the scenario to install .NET to a default path or to an exactly specified custom path, when you specify the architecture (and it is not the same as the OS architecture).
    The architecture string is now always appended to the end of the install path.
    It is also not documented where the installation will end up, so you have to guess or look at the source for that.

  10. v-priya-kinthali commented on Mar 9, 2026

    @v-priya-kinthali
    Contributor

    Hello @matherm-aboehm👋,
    Thank you for your feedback! As you noted, the architecture string is appended to the install path for cross-architecture installs. This is done to prevent binary conflicts. When multiple architectures of the same .NET SDK version are installed into the same directory, the second install would overwrite the first one's native binaries, which could lead to runtime failures. The subdirectory separation ensures both installs can coexist safely.

    You're absolutely right that this install path behaviour should be clearly documented. We will update the documentation to describe the install path behaviour for cross-architecture installs for better clarity. Thanks again!

  11. Frulfump commented on Mar 9, 2026

    @Frulfump

    Hello @matherm-aboehm👋,
    Thank you for your feedback! As you noted, the architecture string is appended to the install path for cross-architecture installs. This is done to prevent binary conflicts. When multiple architectures of the same .NET SDK version are installed into the same directory, the second install would overwrite the first one's native binaries, which could lead to runtime failures. The subdirectory separation ensures both installs can coexist safely.

    You're absolutely right that this install path behaviour should be clearly documented. We will update the documentation to describe the install path behaviour for cross-architecture installs for better clarity. Thanks again!

    Since this is closed as completed please link to a new issue that tracks the documentation update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature requestNew feature or request to improve the current logic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions