如何从 Visual Studio 中的解决方案中卸载 *all* nuget 包 [英] How do I uninstall *all* nuget packages from a solution in Visual Studio
问题描述
我知道我可以从 PM 控制台卸载包.我在另一个项目中遇到了一些依赖问题我想重新开始,我需要一口气删除所有包.有办法吗?
I know I can uninstall-package from the PM console. I got into some dependency issues with another project and I want to start over, and I need to delete all packages in one shot. Is there a way?
推荐答案
要从解决方案中的所有项目中获取所有包,请使用 Get-Package
.要从特定项目中获取所有包,请使用 Get-Package -ProjectName "YourProjectName"
.
To get all packages from all projects in the solution use Get-Package
. To get all packages from a specific project use Get-Package -ProjectName "YourProjectName"
.
小心:这将卸载解决方案中的所有包.如果使用 -Force
参数,即使存在依赖关系,包也会被删除.
Be careful: This will uninstall ALL packages in the solution. If
-Force
parameter is used, packages are removed even if dependencies exist.
Get-Package | Uninstall-Package -RemoveDependencies -Force
小心:这将卸载项目中的所有包.如果使用 -Force
参数,即使存在依赖关系,包也会被删除.
Be careful: This will uninstall ALL packages in the project. If
-Force
parameter is used, packages are removed even if dependencies exist.
Get-Package -ProjectName "YourProjectName" |
Uninstall-Package -ProjectName "YourProjectName" -RemoveDependencies -Force
这篇关于如何从 Visual Studio 中的解决方案中卸载 *all* nuget 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!