Reputation: 10889
I have a private NuGet feed where I publish package A. A has a version like 4.0.0.X (where X is the build number). When I change code, the build number is incremented and the package is published.
In the csproj, I have referenced the package like this:
<PackageReference Include="A" Version="4.0.*" />
I want to get the newest version of A, which has no major changes (which would result in a bump the minor section...). Unfortunately, if Nuget has downloaded a Version of A, it never attempts to check if there is a newer version. I can check manually, but then Nuget automatically pins the version in the csproj, which I have to re-edit.
How can I fix this? Fix means: I want a smooth dev experience for my CI workflow. Ideally, I have the newest package version on my dev computer without lots of manual work.
Upvotes: 0
Views: 77
Reputation: 1661
NuGet has caching strategies to avoid re-downloading packages/hitting the network all the time.
It dumps a little cache file in your obj that tells it whether you've changed your dependencies at all.
You will need to force NuGet to reevaluates the available packages from remote sources, by using the -force option. /p:RestoreForce=true, or --force in dotnet CLI. In Visual Studio, currently a rebuild will do a force restore.
NuGet also has a http caching strategy that avoids hitting the remote feeds for 30 mins. To override that, use -NoCache from the commandline. Currently there's no option to override that in Visual Studio.
tl;dr; NuGet caches a lot of things to improve performance and remote unnecessary remote calls. Avoid that by calling restore with the --force/rebuilding.
Upvotes: 1