Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade nuget packages if the installed version is missing?

Running into a situation where I deployed an application to production a few months ago and now I need to do some work on it, on an entirely new machine. The first I do is pull source and nuget restore won't restore because it can't find the particular version of the package it was developed under. When I check nuget.org for this package version it is not there. So how do I upgrade my solution to the latest binaries?

Visual Studio 2013 trying to update ServiceStack '4.0.39' to latest, which is '4.0.40' at the time of this post.

Thank you, Stephen

like image 447
Stephen Patten Avatar asked Feb 10 '23 06:02

Stephen Patten


2 Answers

The best solution I've come up with for this is to manually edit the Packages.config file(s) and set the version number to whatever you want. Restore should then work. It's not a perfect solution but it has dug me out of some holes.

like image 94
Tim Long Avatar answered Apr 26 '23 14:04

Tim Long


(I know this is an old answer, but it just came up in some Googling)

One issue with the accepted answer (of just updating the version # in packages.config) is that this is just triggering a "package restore"--and will skip any "installation steps" the package might have (things that were done automatically when you first added the package, such as adding assembly references, modifying config files, etc.).

An alternative way would be to edit the packages.config and REMOVE the package in question from there---then start up VS and add the new version. This will trigger the package's usual install routine to do it's thing.

like image 44
DotNetSparky Avatar answered Apr 26 '23 14:04

DotNetSparky