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

Failed to install dotnet, exit code: 1. dotnet-install: The current user doesn't have write access to the installation root 'C:\Program Files\dotnet #571

Open
4 tasks
Miguel-AgRz opened this issue Dec 30, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@Miguel-AgRz
Copy link

Description:
installer is trying to install in program files

Task version:
6.0.x

Platform:

  • Ubuntu
  • macOS
  • [x ] Windows

Runner type:

  • Hosted
  • Self-hosted

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

Expected behavior:
it should install in user environment or work folder

Actual behavior:
A description of what is actually happening.

@Miguel-AgRz Miguel-AgRz added bug Something isn't working needs triage labels Dec 30, 2024
@aparnajyothi-y
Copy link
Contributor

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

@mahabaleshwars mahabaleshwars self-assigned this Dec 31, 2024
@mahabaleshwars
Copy link

Hi @Miguel-AgRz,
The installation process fails because the user doesn't have write access to 'C:\Program Files\dotnet'. This is a common issue when trying to install software in directories that require elevated permissions.

Suggested Solutions

  1. Change Installation Directory: Modify the workflow to install .NET in a directory that the user has write access to, such as a user-specific directory.
  2. Elevate Permissions: Run the installation process with elevated permissions if possible.

Let us know if either of these solutions resolves the issue. If the problem persists, please provide the repro steps or a link to a repository so we can investigate further.

@Mykhailo-Roit
Copy link

I found a problem
In workflow file "8.0.101"

      - name: Set up .NET Core
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: "8.0.101"

But the agent tried to install '8.0.12'
Image

A temporary solution is to grant access to "C:\Program Files\dotnet" for the agent running user

@Mykhailo-Roit
Copy link

you use https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json as DotnetCoreIndexFallbackUrl
and here

{
"channel-version": "8.0",
"latest-release": "8.0.12",
"latest-release-date": "2025-01-14",
"security": true,
"latest-runtime": "8.0.12",
"latest-sdk": "8.0.405",
"product": ".NET",
"support-phase": "active",
"eol-date": "2026-11-10",
"release-type": "lts",
"releases.json": "https://builds.dotnet.microsoft.com/dotnet/release-metadata/8.0/releases.json",
"supported-os.json": "https://builds.dotnet.microsoft.com/dotnet/release-metadata/8.0/supported-os.json"
},

why do you not use latest-sdk value?

@mahabaleshwars
Copy link

Hello @Mykhailo-Roit,

The setup-dotnet action installs the latest stable LTS runtime by default, which in this case is version 8.0.12. However, it will also successfully install the specific .NET SDK version you request, such as 8.0.101, as indicated in your workflow file.

It's important to understand that the SDK and runtime versions are handled separately. Specifying an SDK version (like 8.0.101) does not automatically install the corresponding runtime version. As a result, the runtime will default to the latest stable LTS version (8.0.12), even though the requested SDK version (8.0.101) is installed correctly.

With the release of setup-dotnet v4.0.0, an install-script was introduced to ensure the LTS version of the .NET executable is installed automatically, addressing issues seen in the previous v3.x version. You can check the release notes for further details.

Additionally, keep in mind that the versions already installed on the runner image will be readily available. For example, on macOS 14, the runtime version 8.0.10 is pre-installed (see macos-14 Readme).

Let me know if you need further clarification!

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