Problem with uninstalling NuGet Packages

后端 未结 6 756
我寻月下人不归
我寻月下人不归 2021-02-13 02:59

I\'m trying to uninstall some packages installed by NuGet. According to the doc described here, I should see an Uninstall button (first screenshot below) when I

6条回答
  •  长发绾君心
    2021-02-13 03:19

    Sometimes there are dependencies that disallow uninstalling a package, but you need to do so anyway (i.e. if you inadvertently install two different versions of a package with dependencies).

    When this happens, the only way to uninstall the packages is to force the uninstallation, and this can only be done through the Package Manager Console.

    Before going to the Console, you should open the Manage NuGet Packages window, and note down the Id and Version of your package, which appears on the right pane when you click on the package.

    Then you can close the Manage window, and open the console (Package Manager Console), and run this command:

    uninstall-package -Id YourPackageId -Force -Version YourPackageVersion
    

    Note the -Force parameter. For example

    uninstall-package -Id Unity -Force -Version 3.0.1304.0
    

    This command allows to uninstall the version 3 when it is installed in parallel with version 2, which can't be done throgh the Manage window.

提交回复
热议问题