Package Manager Console的使用
Find-Package
PM> Find-Package autofac
https://docs.microsoft.com/en-us/nuget/tools/ps-ref-find-package
Id Versions Description
-- -------- -----------
Autofac {4.9.0} Autofac is an IoC container for Microsoft .NET. It manages the dependencies between classes so that applications stay easy to...
Autofac.Extras.AggregateService {4.1.0} Aggregate services are sets of dependencies you can treat as a single dependency. This extension enables support for aggregat...
Aliencube.Autofac.Extras.CommonS... {4.0.1} The Microsoft Enterprise Library provides a Common Service Locator for abstracting away IoC containers. .NET Standard port of...
Autofac.Extensions.DependencyInj... {4.3.1} Autofac implementation of the interfaces in Microsoft.Extensions.DependencyInjection.Abstractions, the .NET Framework depende...
Autofac.Configuration {4.1.0} Configuration support for Autofac.
Autofac.Extras.CommonServiceLocator {5.0.0} Autofac extension for using the Microsoft Enterprise Library Common Service Locator with Autofac.
Autofac.Extras.Moq {4.3.0} Autofac extension for automocking and creation of mock objects in Moq.
Autofac.Extras.DynamicProxy {4.5.0} Autofac extension for enabling AOP in conjunction with Castle.
Autofac.Multitenant {4.2.0} Autofac extension for multitenant application support.
Autofac.Extras.FakeItEasy {5.0.1} Autofac extension supporting generation of FakeItEasy objects.
Autofac.ServiceFabric {2.1.0} Autofac integration for Azure Service Fabric. Provides service factory implementations for Actors, Stateful Services and Stat...
NugetyCore.Autofac {1.0.1} NugetyCore.Autofac package summary
Autofac.Extras.MvvmCross {5.0.0} Autofac extension supporting MvvmCross dependency injection.
Autofac.AspNetCore.Multitenant {1.0.2} ASP.NET Core support for multitenant DI via Autofac.Multitenant.
Autofac.Extras.NLog {1.3.0} Autofac Module that integrating Autofac and NLog, it supports both constructor and property injection.
CB.Ioc.Adapter.Autofac {1.0.15.4} The adapter of autofac for CB.Ioc
Flatwhite.Autofac {1.0.26} Flatwhite.Autofac support Flatwhite cache using Autofac
Alexinea.Autofac.Extensions.Depe... {4.2.0} Autofac implementation of the interfaces in Microsoft.Extensions.DependencyInjection.Abstractions, the .NET Framework depende...
Autofac.Engine {4.3.0} MS Autofac.Engine...
Caliburn.Micro.Autofac {1.5.0} Integration of Caliburn.Micro with Autofac. Source code with sample projects available at https://github.com/dbuksbaum/Calibu...
Time Elapsed: 00:00:07.6064034
PM> Find-Package autofac -ExactMatch -AllVersions
Id Versions Description
-- -------- -----------
Autofac {4.9.0, 4.8.1, 4.8.0, 4.7.1...} Autofac is an IoC container for Microsoft .NET. It manages the dependencies between classes so that applications stay easy to...
Time Elapsed: 00:00:06.1354507
按照关键字搜索NuGet的包,并且按照下载量倒序排列
Find-Package -Contains "recaptcha" -Proxy "http://username:password@proxyServer" | Sort-Object -Descending -Property DownloadCount
WARNING: Could not get response from query 'https://api-v2v3search-ea.nuget.org/query?q=recaptcha description:recaptcha&take=200&semverlevel=2.0.0'.
Get-Project
M> Get-Project -All
ProjectName Type FullName
Install-Package
PM> Install-Package autofac -ProjectName LISA.CMSWeb -Version 3.5.0
Uninstall-Package
https://docs.microsoft.com/en-us/nuget/tools/ps-ref-uninstall-package
PM> Uninstall-Package Microsoft.IdentityModel.Tokens -ProjectName LISA.CMSWeb
Attempting to gather dependency information for package 'Microsoft.IdentityModel.Tokens.5.2.2' with respect to project 'LISA.CMSWeb', targeting '.NETFramework,Version=v4.6.1'
Resolving actions to uninstall package 'Microsoft.IdentityModel.Tokens.5.2.2'
Uninstall-Package : Unable to uninstall 'Microsoft.IdentityModel.Tokens.5.2.2' because 'System.IdentityModel.Tokens.Jwt.5.2.2' depends on it.
At line:1 char:1
+ Uninstall-Package Microsoft.IdentityModel.Tokens -ProjectName LISA.CM ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Uninstall-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UninstallPackageCommand
Time Elapsed: 00:00:00.7370564
PM> Uninstall-Package system.IdentityModel.Tokens.Jwt -ProjectName LISA.CMSWeb
Attempting to gather dependency information for package 'System.IdentityModel.Tokens.Jwt.5.2.2' with respect to project 'LISA.CMSWeb', targeting '.NETFramework,Version=v4.6.1'
Resolving actions to uninstall package 'System.IdentityModel.Tokens.Jwt.5.2.2'
Uninstall-Package : Unable to uninstall 'System.IdentityModel.Tokens.Jwt.5.2.2' because 'IdentityModel.OIDCRelyingParty.5.1.2' depends on it.
At line:1 char:1
+ Uninstall-Package system.IdentityModel.Tokens.Jwt -ProjectName LISA.C ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Uninstall-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UninstallPackageCommand
Time Elapsed: 00:00:00.2100244PM> Uninstall-Package IdentityModel.OIDCRelyingParty -ProjectName LISA.CMSWeb
Attempting to gather dependency information for package 'IdentityModel.OIDCRelyingParty.5.1.2' with respect to project 'LISA.CMSWeb', targeting '.NETFramework,Version=v4.6.1'
Resolving actions to uninstall package 'IdentityModel.OIDCRelyingParty.5.1.2'
Resolved actions to uninstall package 'IdentityModel.OIDCRelyingParty.5.1.2'
Removed package 'IdentityModel.OIDCRelyingParty.5.1.2' from 'packages.config'
Successfully uninstalled 'IdentityModel.OIDCRelyingParty.5.1.2' from LISA.CMSWeb
Removing package 'IdentityModel.OIDCRelyingParty.5.1.2' from folder 'C:\Users\clu\source\repos\Edenred\LISA_5.0.0.0\Solution\packages'
Removed package 'IdentityModel.OIDCRelyingParty.5.1.2' from folder 'C:\Users\clu\source\repos\Edenred\LISA_5.0.0.0\Solution\packages'
Executing nuget actions took 38.2 sec
Time Elapsed: 00:00:38.3872971PM> Uninstall-Package IdentityModel.OIDCRelyingParty -ProjectName LISA.CMSWeb
Attempting to gather dependency information for package 'System.IdentityModel.Tokens.Jwt.5.2.2' with respect to project 'LISA.CMSWeb', targeting '.NETFramework,Version=v4.6.1'
Resolving actions to uninstall package 'System.IdentityModel.Tokens.Jwt.5.2.2'
Resolved actions to uninstall package 'System.IdentityModel.Tokens.Jwt.5.2.2'
Removed package 'System.IdentityModel.Tokens.Jwt.5.2.2' from 'packages.config'
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Successfully uninstalled 'System.IdentityModel.Tokens.Jwt.5.2.2' from LISA.CMSWeb
Removing package 'System.IdentityModel.Tokens.Jwt.5.2.2' from folder 'C:\Users\clu\source\repos\Edenred\LISA_5.0.0.0\Solution\packages'
Removed package 'System.IdentityModel.Tokens.Jwt.5.2.2' from folder 'C:\Users\clu\source\repos\Edenred\LISA_5.0.0.0\Solution\packages'
Executing nuget actions took 12.33 sec
Time Elapsed: 00:00:12.4535618
PM> Uninstall-Package Microsoft.IdentityModel.Tokens -ProjectName LISA.CMSWeb
Attempting to gather dependency information for package 'Microsoft.IdentityModel.Tokens.5.2.2' with respect to project 'LISA.CMSWeb', targeting '.NETFramework,Version=v4.6.1'
Resolving actions to uninstall package 'Microsoft.IdentityModel.Tokens.5.2.2'
Resolved actions to uninstall package 'Microsoft.IdentityModel.Tokens.5.2.2'
Removed package 'Microsoft.IdentityModel.Tokens.5.2.2' from 'packages.config'
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Successfully uninstalled 'Microsoft.IdentityModel.Tokens.5.2.2' from LISA.CMSWeb
Removing package 'Microsoft.IdentityModel.Tokens.5.2.2' from folder 'C:\Users\clu\source\repos\Edenred\LISA_5.0.0.0\Solution\packages'
Removed package 'Microsoft.IdentityModel.Tokens.5.2.2' from folder 'C:\Users\clu\source\repos\Edenred\LISA_5.0.0.0\Solution\packages'
Executing nuget actions took 19.47 sec
Time Elapsed: 00:00:19.5635814
PM> Uninstall-Package IdentityModel -ProjectName LISA.CMSWeb
Attempting to gather dependency information for package 'IdentityModel.3.6.1' with respect to project 'LISA.CMSWeb', targeting '.NETFramework,Version=v4.6.1'
Resolving actions to uninstall package 'IdentityModel.3.6.1'
Uninstall-Package : Unable to uninstall 'IdentityModel.3.6.1' because 'IdentityModel.OIDCRelyingParty.5.1.2' depends on it.
At line:1 char:1
+ Uninstall-Package IdentityModel -ProjectName LISA.CMSWeb
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Uninstall-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UninstallPackageCommand
Time Elapsed: 00:00:00.2785399
使用Force参数
PM> Uninstall-Package IdentityModel -Force -ProjectName LISA.CMSWeb
Attempting to gather dependency information for package 'IdentityModel.3.6.1' with respect to project 'LISA.CMSWeb', targeting '.NETFramework,Version=v4.6.1'
Resolving actions to uninstall package 'IdentityModel.3.6.1'
Resolved actions to uninstall package 'IdentityModel.3.6.1'
Removed package 'IdentityModel.3.6.1' from 'packages.config'
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Successfully uninstalled 'IdentityModel.3.6.1' from LISA.CMSWeb
Removing package 'IdentityModel.3.6.1' from folder 'C:\Users\clu\source\repos\Edenred\LISA_5.0.0.0\Solution\packages'
Removed package 'IdentityModel.3.6.1' from folder 'C:\Users\clu\source\repos\Edenred\LISA_5.0.0.0\Solution\packages'
Executing nuget actions took 2.51 sec
Time Elapsed: 00:00:02.8075028
RemoveDependencies参数
移除package,同时移除所有的依赖
注意事项
如果是把一个website项目,移动到一个现有的Repository中的话。
需要先清空solution文件同级目录下的packages文件夹。
并且roslyn编译器,需要先uninstall然后再重新install。
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2017-02-15 .net中的目录