Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force nuget to take latest build of a package?

I have a problem with nuget getting the first build of a specifik assembly version, not the latest build. Here are steps that explain what is going on:

  1. Removing local nuget cache.
  2. Delete project.lock.json files in project.
  3. Checking build number for latest build in nuget feed: 102
  4. Run dotnet restore --no-cache.
  5. The project folder is recreated in local cache, but with build number 98.

Both build 98 and 102 have version number 1.2. How can I force dotnet restore to take the latest build of the nuget package without increasing the version number to 1.3?

Thanks!

like image 285
FatAlbert Avatar asked Feb 23 '17 10:02

FatAlbert


People also ask

How do I force a NuGet package to install?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

How do I update NuGet dependencies?

By Command-line: You can download nuget.exe,and add the path where it exists to Path system environment variables. Then you could simply reference the nuget.exe directly. After that you can use command like nuget update YourSolution. sln in Package Manager Console to update the dependencies for solution.


2 Answers

Clear NuGet cache with command dotnet nuget locals all --clear

Then NuGet takes the latest version of the package from the feed.

like image 110
Jiří Kyzlink Avatar answered Oct 08 '22 13:10

Jiří Kyzlink


Follow the answer by Jiří Kyzlink to clear your NuGet cache.

Then follow with a dotnet add ProjectName package PackageName to basically re-add the package and update the versioned reference in the project file.

dotnet restore restores references from the project file. Solely clearing the cache doesn't change your project reference.

like image 26
Ropstah Avatar answered Oct 08 '22 12:10

Ropstah