Search code examples
nugetmonodevelopnuget-package-restore

How to delete package in monodevelop, if it is impossible to restore it?


When I am trying to delete a package from the solution tree, monodevelop gives me a message "Unable to find package " ... " to remove it from the project. Please restore the package first."

I am unable to restore package, because NuGet.exe gives an error
"Error: SendFailure (Error writing headers)" and then
"Unable to find version 'N.M.K' of package 'SomePackageName'"

How to delete these packages?


Solution

  • You should be able to fix the "SendFailure (Error writing headers)" error if you are on Linux by running:

    mozroots --import --sync
    

    If you cannot find the original NuGet package you can manually remove the package. Currently with the built-in NuGet addin in MonoDevelop you cannot forcefully remove a NuGet package. MonoDevelop uses the NuGet package contents to work out what needs to be removed from the project.

    Manual removal will be a case of:

    1. Edit the packages.config file and removing the <package> element for that package.
    2. Edit the project file (.csproj) file and find any references that are from the packages directory (e.g. packages/Newtonsoft.Json.6.0.5) for that NuGet package.