maxence51
maxence51

Reputation: 1054

TFS 2017 - Nuget feed - Delay before restore take last package version

I'm using TFS 2017, with a nuget feed.

After I published a new (non pre-release) version of my package in the feed, let's say My.Package Version 1.0.1, I need to wait about 30 minutes before restoring the project that references the published package.

Otherwise, and even if I see the version 1.0.1 in the TFS Nuget Feed UI, dotnet restore with .net core CLI (and even with --force option) ignores the new version and take the last pre-release version e.g My.Package Version 1.0.1-2019041501

The csproj package reference includes wildcard for pre-release version.

<PackageReference Include="My.Package" Version="1.0.1-*" />

Same thing also happens between two pre-release versions but with a delay of 5 minutes only. E.g After I published My.Package Version 1.0.1-2019041502, I need to wait 5 minutes, otherwise restore take My.Package Version 1.0.1-2019041501.

Nuget package project use .Net Standard 2.0.3 and referencing project use .Net Core 2.2.

What is the cause of this delay?

Thx.

Upvotes: 1

Views: 228

Answers (1)

zivkan
zivkan

Reputation: 14961

NuGet keeps a HTTP cache it uses to speed up identical queries to HTTP sources, and the cache period is 30 minutes. You can clear it using nuget.exe locals http-cache -clear or dotnet nuget locals http-cache --clear. I can't explain the 5 minute delay on prerelease packages though. Is it possible TFS takes 5 minutes to ingest the package after being pushed and make it available in its feed search results? I don't believe that NuGet expires its http-cache more quickly when you request prerelease packages, but it sounds feasible.

Upvotes: 3

Related Questions