Skip to content
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

Using dotnet-version: 7.0.x installs .NET 8.0.x instead onf 7.0.x #597

Open
2 of 5 tasks
MikeSchulze opened this issue Jan 22, 2025 · 5 comments
Open
2 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@MikeSchulze
Copy link

MikeSchulze commented Jan 22, 2025

Description:
I added the setup-dotnet action to install Net 7.0.x if is required, but it installs the NET 8.0.x

Task version:
actions/setup-dotnet@v4

Platform:

  • Ubuntu 22.04.5
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:

    - name: 'Setup .NET SDK'
      uses: actions/setup-dotnet@v4
      with:
        dotnet-version: '7.0.x'

Expected behavior:
I used a matrix and caching action behind, but the installation looks wrong.
https://github.com/MikeSchulze/gdUnit4-action/blob/50ab18fa8987997062e88fae49211bb751674e89/action.yml#L158

Actual behavior:

Run sdk_version=$(echo "net7.0" | sed 's/^net\([0-9]\.[0-9]\)$/\1.x/')
Using .NET version: '7.0.x'
Run actions/setup-dotnet@v4
  with:
    dotnet-version: 7.0.x
    cache: false
  env:
    CACHE_NAME: Linux-Godot_v4.2-stable-net7.0
    RUN_GDSCRIPT_TESTS: false
    GDUNIT_VERSION: master
    SDK_VERSION: 7.0.x
    DOTNET_VERSION: net7.0
/home/runner/work/_actions/actions/setup-dotnet/v4/externals/install-dotnet.sh --skip-non-versioned-files --runtime dotnet --channel LTS
dotnet-install: Attempting to download using aka.ms link https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-linux-x64.tar.gz
dotnet-install: Remote file https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-linux-x64.tar.gz size is 31279408 bytes.
dotnet-install: Extracting archive from https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-linux-x64.tar.gz
dotnet-install: Downloaded file size is 31279408 bytes.
dotnet-install: The remote and local file sizes are equal.
dotnet-install: Installed version is 8.0.12
dotnet-install: Adding to current process PATH: `/usr/share/dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
/home/runner/work/_actions/actions/setup-dotnet/v4/externals/install-dotnet.sh --skip-non-versioned-files --channel 7.0
dotnet-install: .NET Core SDK with version '7.0.410' is already installed.
Run cd "./"
8.0.404
  Determining projects to restore...
  Restored /home/runner/work/gdUnit4-action/gdUnit4-action/test.csproj (in 2.16 sec).
  test -> /home/runner/work/gdUnit4-action/gdUnit4-action/.godot/mono/temp/bin/Debug/test.dll
Build succeeded.
    0 Warning(s)
    0 Error(s)
Time Elapsed 00:00:13.91
Project 'test' has the following package references
   [net7.0]: 
   Top-level Package             Requested   Resolved
   > gdUnit4.api                 4.3.*       4.3.1   
   > gdUnit4.test.adapter        2.0.*       2.0.0   
   > Godot.SourceGenerators      4.2.1       4.2.1   
   > GodotSharp                  4.2.1       4.2.1   
   > GodotSharpEditor            4.2.1       4.2.1   
   > Microsoft.NET.Test.Sdk      17.9.0      17.9.0  
@MikeSchulze MikeSchulze added bug Something isn't working needs triage labels Jan 22, 2025
@priya-kinthali
Copy link

Hello @MikeSchulze👋,
Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.

@petesramek
Copy link

petesramek commented Jan 30, 2025

UPDATE: After an additional investigation it seems the issue with .NET Core SDK 2.0 is caused by an issue with download at source. I've opened an issue: .NET Core 2.0 SDK download links are mixed up with .NET Core 2.1 version

Image

I have run into similar issue. .NET Core SDK 2.0 is not installed. Instead, version 2.1 is. As this won't be a priority issue, I am just adding it here for people that might need to find a workaround.

Description:
I have added the setup-dotnet action to install all .NET SDKs supported by .NET Standard [2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0].

Task version:

actions/setup-dotnet@v3
actions/setup-dotnet@v4

Platform:

  • [ x ] Ubuntu

  • [ x ] macOS

  • [ x ] Windows

Runner type:

  • [ x ] Hosted

  • Self-hosted

Expected behavior:

All requested versions of SDK are installed correctly.

YAML

- name: Install .NET SDK
  uses: actions/setup-dotnet@v4
  with:
    dotnet-version: |
      2.0.x
      2.1.x
      2.2.x
      3.0.x
      3.1.x
      5.x
      6.x
      7.x
      8.x
      9.x

Console Output

/Users/runner/work/_actions/actions/setup-dotnet/v4/externals/install-dotnet.sh --skip-non-versioned-files --channel 2.0
dotnet-install: Attempting to download using primary link https://builds.dotnet.microsoft.com/dotnet/Sdk/2.1.202/dotnet-sdk-2.1.202-osx-x64.tar.gz
dotnet-install: Remote file https://builds.dotnet.microsoft.com/dotnet/Sdk/2.1.202/dotnet-sdk-2.1.202-osx-x64.tar.gz size is 170710640 bytes.
dotnet-install: Extracting archive from https://builds.dotnet.microsoft.com/dotnet/Sdk/2.1.[20](https://github.com/petesramek/polyline-algorithm-csharp/actions/runs/13056443705/job/36428618609#step:3:21)2/dotnet-sdk-2.1.202-osx-x64.tar.gz
dotnet-install: Downloaded file size is 170710640 bytes.
dotnet-install: The remote and local file sizes are equal.
dotnet-install: Installed version is 2.1.202
dotnet-install: Adding to current process PATH: `/Users/runner/.dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.

Workaround:

To install all requested .NET SDKs, you can use actions/setup-dotnet@v2, which works for all versions correctly.

- name: Install .NET SDK
  uses: actions/setup-dotnet@v2
  with:
    dotnet-version: |
      2.0.x
      2.1.x
      2.2.x
      3.0.x
      3.1.x
      5.x
      6.x
      7.x
      8.x
      9.x

@mahabaleshwars
Copy link

Hi @MikeSchulze, this is expected behavior with setup-dotnet@v4. Here's what you can expect:

It ensures a minimal installation of the latest runtime version to provide the most up-to-date stable .NET executable.
It installs the necessary SDK based on your needs.
This update addresses issue #387 . Previously, setup-dotnet@v3 would overwrite the .NET executable on every action run, potentially causing failures if the executable was still in use. In setup-dotnet@v4, we’ve resolved this by adding an install script that installs the LTS version of the .NET executable, which is used for all subsequent installations (see #433 ).

The first install script performs the download only once per workflow.

If you need an earlier SDK version, you can specify it in a global.json file. For more details, refer to the setup-dotnet documentation.

@MikeSchulze
Copy link
Author

That's sounds strange, how can this the expected behavior?

There is an option dotnet-version: to set the version to install, so you break this option with v4.
And I see no relation to #387
With v4 we need now to define in addition a global.json that makes the option dotnet-version: obsolete to define the version.
014f8c8

@petesramek
Copy link

Hi @MikeSchulze,

I would say, that @mahabaleshwars meant that in addition to requested version latest LTS version is installed.

In your case version 7.0.410 is already installed. dotnet-install: .NET Core SDK with version '7.0.410' is already installed.

On top of that latest LTS is installed. dotnet-install: Installed version is 8.0.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants