C#C
C#2y ago
Turwaith

Nuget restore (via gitlab runner) fails at a specific package

I am trying to set up a windows gitlab runner to build and publish my WPF .NET Framework 4.8 project. My gitlab-ci.yml file looks as follows:

stages:
  - build_and_publish

build_and_publish:
  stage: build_and_publish
  script:
    - 'nuget locals all -clear'
    - 'nuget restore $env:SOLUTION_NAME -SolutionDirectory .'
    - 'dotnet add "$env:PROJECT_PATH" package Microsoft.Toolkit.Uwp.Notifications --version 7.1.3'
    - '& "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" $env:SOLUTION_NAME /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath="$env:CI_PROJECT_DIR\bin\Release\"'
    - 'mkdir Publish'
    - 'xcopy /I /E /Y "$env:CI_PROJECT_DIR\bin\Release\*" Publish/'
    - 'Compress-Archive -Path Publish\* -DestinationPath Publish\Product.zip -Force'
  artifacts:
    name: "Product-${CI_COMMIT_REF_NAME}"
    paths:
      - Publish/Product.zip
    expire_in: never
  tags:
    - windows

variables:
  SOLUTION_NAME: './Source/Product.sln'
  PROJECT_PATH: './Source/Product.GUI/Product.GUI.csproj'

cache:
  paths:
    - .nuget/


Now my project contains the following external packages:
  • Microsoft.Toolkit.Uwp.Notifications/7.1.3
  • PDFtoPrinter/1.5.0
  • Serilog.Sinks.File
  • Serilog
Now the runner can successfully restore all the package EXCEPT the first one (Notifications). I have even, as you can see, specifically added the package through the script. It definitely is available on the nuget source. On my local machine (Windows 11, Rider) there is not a single problem with restore and build.

Does anyone have any idea why my windows runner fails at restoring this specific package?
Was this page helpful?