Resolved: Azure DevOps Pipelines Failing with NU1101, NU1102 at Publish Time

Our pipelines were green, and all of a sudden started failing with no code change with the below errors:

NU1101: Unable to find package No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages.

NU1102: Unable to find package runtime.any.System.Text.Encoding.Extensions with version (>= 4.3.0). Found 1 version(s) in Microsoft Visual Studio Offline Packages [ Nearest version: 4.0.11]

Looking at NU1102, it seemed at first there could be a problem fetching the latest versions of packages from NuGet, however all our feeds had an UpStream setup to read the latest package versions from NuGet.

Then we tried to verify if caching was the problem, and hence we enabled noCache at build time, with no success.

- task: DotNetCoreCLI@2
    command: 'build'
    projects: '**/*.csproj'
    noCache: true
    arguments: '--configuration $(buildConfiguration)'
  displayName: 'Build $(buildConfiguration)'

And we also tried cleaning the working directory before Publish time, which didn’t work either.

- task: PowerShell@2
  displayName: Clean
    targetType: 'inline'
    script: |
      dotnet nuget locals all --clear

Finally what fixed the problem was to add nuget.config file at the root of our .Net solution, with package sources pointing directly at NuGet and our internal feeds.

<?xml version="1.0" encoding="utf-8"?>
    <clear />
    <add key="Nuget" value="" />
    <add key="Released" value="***/_packaging/Released/nuget/v3/index.json" />

I hope this helps someone.

Leave a Reply

%d bloggers like this: