actions / setup-dotnet

Set up your GitHub Actions workflow with a specific version of the .NET core sdk
MIT License
944 stars 465 forks source link

Looks like when setup-dotnet is used, then the install path is different from the hosted images #554

Open nicro950 opened 1 week ago

nicro950 commented 1 week ago

Description: We started getting build errors where it reported that it could not run because dotnet was not installed, but it had just executed a test which required dotnet. After some research it looks like when the setup-dotnet is used, that dotnet is installed to another folder, then the bundled dotnet instance of the container image. We based us on the assumption, (which have worked in over a month) that use-dotnet installed the dotnet version to the same folder as the base image. When we installed dotnet 9 rc 2, then we suddenly could no longer build asp.net core dotnet 8, but dotnet 8 are still available. Is it intended behavior that it should install to another folder, and having to install both dotnet 8 and dotnet 9 for repos with both versions, or should it install dotnet 9 to the same location that the dotnet 8 is installed?

The output log from running the repro steps from dotnet --info

before setup:

Run dotnet --info
.NET SDK:
 Version:           8.0.108
 Commit:            665a05cea7
 Workload version:  8.0.100-manifests.109ff937

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  24.04
 OS Platform: Linux
 RID:         ubuntu.24.04-x64
 Base Path:   /usr/lib/dotnet/sdk/8.0.108/

.NET workloads installed:
 Workload version: 8.0.100-manifests.109ff937
There are no installed workloads to display.

Host:
  Version:      8.0.8
  Architecture: x64
  Commit:       08338fcaa5

.NET SDKs installed:
  8.0.108 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.8 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.8 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

after setup:

Run dotnet --info
.NET SDK:
 Version:           9.0.100-rc.2.24474.11
 Commit:            315e1305db
 Workload version:  9.0.100-manifests.cea95dba
 MSBuild version:   17.12.0-preview-24473-03+fea15fbd1

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  24.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/9.0.100-rc.2.24474.11/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0-rc.2.24473.5
  Architecture: x64
  Commit:       990ebf52fc

.NET SDKs installed:
  9.0.100-rc.2.24474.11 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

After also running dotnet-setup for dotnet 8

Run dotnet --info
.NET SDK:
 Version:           9.0.100-rc.2.24474.11
 Commit:            315e1305db
 Workload version:  9.0.100-manifests.cea95dba
 MSBuild version:   17.12.0-preview-24473-03+fea15fbd1

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  24.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/9.0.100-rc.2.24474.11/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0-rc.2.24473.5
  Architecture: x64
  Commit:       990ebf52fc

.NET SDKs installed:
  8.0.403 [/usr/share/dotnet/sdk]
  9.0.100-rc.2.24474.11 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Task version: actions/setup-dotnet@v4

Platform:

Runner type:

Repro steps:
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.

- name: Before setup
  run: dotnet --info
- uses: actions/setup-dotnet@v4
  with:
    dotnet-version: '9.0.x'
- name: After dotnet 9
  run: dotnet --info
- uses: actions/setup-dotnet@v4
  with:
    dotnet-version: '8.0.x'
- name: After dotnet 8
  run: dotnet --info

Expected behavior: I excepted it to install to the same folder as the image used, so we did not have to also install the dotnet 8 version since that is bundled with the github actions default runner image. Either that or that only dotnet 9 was installed and failed with that no dotnet 8 version was available, since it was very confusing that mostly things worked, but somethings failed since asp.net core was not installed.

Actual behavior: dotnet-setup installs the latest version of dotnet 8, but not asp.net core 8, as well as the targeted version to another folder, resulting in trying to build a dotnet 8 asp.net core application to fail without also installing the lastest dotnet 8 vesion

aparnajyothi-y commented 1 week ago

Hello @nicro950, Thank you for creating this issue and we will look into it :)