Notification texts go here Contact Us Buy Now!

Since dotnet/sdk:8.0, dotnet restore takes too long on gitlab ci with docker

Challenge: Since dotnet/sdk:8.0, dotnet restore takes too long on GitLab CI with Docker.

Solution: NuGet team has proposed a workaround for this issue:
https://github.com/NuGet/Home/issues/13062

Workaround Steps:

  1. Create a file named NuGet.config in the root folder of your project.
  2. Add the following content to the file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="globalPackagesFolder" value="NuGetPackages" />
  </config>
</configuration>
  1. Commit the changes to your source control.
  2. Update your GitLab CI config to use the new NuGet.config file.
Example:
image: mcr.microsoft.com/dotnet/sdk:8.0

stages:
  - restore
  - build

restore:
  stage: restore
  script:
    - dotnet restore --configfile NuGet.config

build:
  stage: build
  script:
    - dotnet build

Additional Information:

  • This workaround is not a permanent fix, and it may not work for all projects.
  • The NuGet team is working on a permanent fix for this issue.
  • In the meantime, you can use this workaround to reduce the time it takes for dotnet restore on GitLab CI with Docker.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.