zoukankan      html  css  js  c++  java
  • 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

    https://docs.microsoft.com/en-us/powershell/module/packagemanagement/uninstall-package?view=powershell-6

    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.2100244

    PM> 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:Usersclusource eposEdenredLISA_5.0.0.0Solutionpackages'
    Removed package 'IdentityModel.OIDCRelyingParty.5.1.2' from folder 'C:Usersclusource eposEdenredLISA_5.0.0.0Solutionpackages'
    Executing nuget actions took 38.2 sec
    Time Elapsed: 00:00:38.3872971

    PM> 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:Usersclusource eposEdenredLISA_5.0.0.0Solutionpackages'
    Removed package 'System.IdentityModel.Tokens.Jwt.5.2.2' from folder 'C:Usersclusource eposEdenredLISA_5.0.0.0Solutionpackages'
    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:Usersclusource eposEdenredLISA_5.0.0.0Solutionpackages'
    Removed package 'Microsoft.IdentityModel.Tokens.5.2.2' from folder 'C:Usersclusource eposEdenredLISA_5.0.0.0Solutionpackages'
    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:Usersclusource eposEdenredLISA_5.0.0.0Solutionpackages'
    Removed package 'IdentityModel.3.6.1' from folder 'C:Usersclusource eposEdenredLISA_5.0.0.0Solutionpackages'
    Executing nuget actions took 2.51 sec
    Time Elapsed: 00:00:02.8075028

    RemoveDependencies参数

    移除package,同时移除所有的依赖

    注意事项

    如果是把一个website项目,移动到一个现有的Repository中的话。

    需要先清空solution文件同级目录下的packages文件夹。

    并且roslyn编译器,需要先uninstall然后再重新install。

  • 相关阅读:
    video和audio
    H5-geolocation学习
    hammer.js学习
    echarts学习
    移动端手势识别
    SVG
    e.key && e.which && e.keyCode
    git中避免提交.DS_Store文件[转载]
    前端笔试题[1]
    Javascript实现格式化输出
  • 原文地址:https://www.cnblogs.com/chucklu/p/10384964.html
Copyright © 2011-2022 走看看