Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninstall-package w/ -RemoveDependencies will fail if multiple packages share a common dependency #4026

Closed
SupporterMan opened this issue Nov 29, 2016 · 5 comments

Comments

@SupporterMan
Copy link

Details about Problem

According to the document for Uninstall NuGet packages, the "-RemoveDependencies" parameter could "Uninstalls the package and its unused dependencies. That is, if any dependency has another package that depends on it, it is skipped.".

But if there are two packages that both depend on a same dependencies, when I try use command "Uninstall-Package PackageName -RemoveDependencies", it will give me below error message and the process of uninstall package is failed.

Uninstall-Package : Unable to uninstall 'DependencisPackageName' because 'AnotherPackageName' depends on it.
At line:1 char:1

  • Uninstall-Package PackageName -RemoveDependencies
  •   + CategoryInfo          : NotSpecified: (:) [Uninstall-Package], Exception
      + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UninstallPackageCommand
    

NuGet product used: Package Manager Console
NuGet version: 3.5.0
VS version: Visual Studio 2015 with Update 3

Detailed repro steps so we can see the same problem

  1. Created new solution.
  2. Installed WindowsAzure.Storage and Nancy.Serialization.JsonNet (both depend on Newtonsoft.Json).
  3. Uninstall WindowsAzure.Storage from Package Manager Console in Visual Studio 2015 with command "Uninstall-Package WindowsAzure.Storage -RemoveDependencies"
@rrelyea
Copy link
Contributor

rrelyea commented Nov 29, 2016

@SupporterMan - it would help us prioritize, if you could help tell us if this had worked in earlier versions?

@troshko111
Copy link

@rrelyea
I found a [http://www.marcusoft.net/2011/02/nuget-uninstall-remove-dependencies.html](blog post) where some guy left a comment suggesting that did not work back 10 months ago.

My guess would be that hasn't been working for quite some time. Uninstalling packages is like super core feature of a package manager, I would probably suggest this is a P0 issue. Uninstalling anything is quite some pain right now

@SupporterMan
Copy link
Author

@rrelyea I have tested in nuget 3.0 and nuget 3.4.4, the same result. It seems that it doesn't work from previous version of NuGet.

@rrelyea rrelyea changed the title NuGet Pacakge uninstall with command "-RemoveDependencies" doesn't work NuGet Pacakge uninstall with command "-RemoveDependencies" will fail if multiple packages share a common dependency Dec 5, 2016
@rrelyea rrelyea changed the title NuGet Pacakge uninstall with command "-RemoveDependencies" will fail if multiple packages share a common dependency uninstall-package w/ -RemoveDependencies will fail if multiple packages share a common dependency Dec 5, 2016
@rrelyea
Copy link
Contributor

rrelyea commented Dec 6, 2016

This appears to be a problem with packages.config projects. If you move to Project.json (uwp-style) today, or PackageReferences in VS2017 and later, it moves to a place where you only list those 2 dependencies (WindowsAzure.Storage or Nancy.Serialization.JsonNet). At that point, you can more easily remove usage of either one.

We're going to be focusing our energy on PackageReferences, and enabling everybody to move towards that model. As such, there are things that are less than ideal about Packages.Config projects and how they work in NuGet. Our solution here is to migrate people towards PackageReferences (or uwp-style project.json if they cannot require vs2017).

@rrelyea rrelyea added this to the 4.0 RC2 milestone Dec 6, 2016
@rrelyea rrelyea modified the milestones: 4.0 RC3, 4.0 RC2, Future-1 Jan 9, 2017
@jagrutichavan
Copy link

I have nuget version 3.5.0 but i want to downgrade it to 3.4.0 so how to do this.or what can be done in this case

@zhili1208 zhili1208 modified the milestones: Future-1, 4.5 Oct 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants