Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uninstall nuget package that no longer exists

We had our nuget server die and the admin never made a backup. So now building on a new install won't work b/c there is nothing in the cache and it can't recreate the dependency list. I tried to force uninstall but it says that I have to restore the package before uninstalling it so it can build the dependency tree. Argh. I just want the package out of the solution so we can rebuild the site. I also tried removing it from packages.config but that didn't help.

Is there a way to manually force delete a nuget package without having access to it anymore? Otherwise I need to build a new solution from scratch and migrate the files over.

Here are the commands I tried:

uninstall-package packagename -RemoveDependencies -force

and

uninstall-package packagename -force

Here is the config file:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="custom.serialization" version="2017.3.20.142224" targetFramework="net462" />
  <package id="custom.themes.flat-blue" version="2016.12.9105400" targetFramework="net452" />
  <package id="Microsoft.AspNet.Cors" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Cors" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net462" />
  <package id="NLog" version="4.4.5" targetFramework="net462" />
  <package id="NLog.Extended" version="4.0.0.1" targetFramework="net452" />
  <package id="NLog.Web" version="4.4.0" targetFramework="net452" />
</packages>

Thanks

like image 944
user441058 Avatar asked Oct 28 '25 00:10

user441058


1 Answers

Looks like I got it working. Here are the steps:

  1. Close the solution.
  2. Delete references to the package from .csproj file
  3. Delete reference from the packages.config file.
  4. Delete all packages from the packages folder in the root.
  5. Open the NuGet configuration and remove the source that had the old files.
  6. Open the solution and tell it to reload all packages. It will then pull down fresh copies of all packages except the one you deleted.

So far the solutions is building and running without any errors about the missing package!

like image 175
user441058 Avatar answered Oct 31 '25 11:10

user441058



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!