zoukankan      html  css  js  c++  java
  • Nuget常用命令

    • Find-Package

      从包源中获取具有指定 ID 或关键字的一组远程包

    # Find packages containing keywords
    Find-Package elmah
    Find-Package logging
    
    # List packages whose ID begins with Elmah
    Find-Package Elmah -StartWith
    
    # By default, Get-Package returns a list of 20 packages; use -First to show more
    Find-Package logging -First 100
    
    # List all versions of the package with the ID of "jquery"
    Find-Package jquery -AllVersions -ExactMatch
    • Get-Package 

    检索本地存储库中安装的包的列表, 列出包源中与-ListAvailable 开关一起使用时可用的包, 或在与-Update 开关一起使用时列出可用的更新。

    # Lists the packages installed in the current solution
    Get-Package
    
    # Lists the packages installed in a project
    Get-Package -ProjectName MyProject
    
    # Lists packages available in the current package source
    Get-Package -ListAvailable
    
    # Lists 30 packages at a time from the current source, and prompts to continue if more are available
    Get-Package -ListAvailable -PageSize 30
    
    # Lists packages with the Ninject keyword in the current source, up to 50
    Get-Package -ListAvailable -Filter Ninject
    
    # List all versions of packages matching the filter "jquery"
    Get-Package -ListAvailable -Filter jquery -AllVersions
    
    # Lists packages installed in the solution that have available updates
    Get-Package -Updates
    
    # Lists packages installed in a specific project that have available updates
    Get-Package -Updates -ProjectName MyProject
    • Install-Package

    将包及其依赖项安装到项目中

    # Installs the latest version of Elmah from the current source into the default project
    Install-Package Elmah
    
    # Installs Glimpse 1.0.0 into the MvcApplication1 project
    Install-Package Glimpse -Version 1.0.0 -Project MvcApplication1
    
    # Installs Ninject.Mvc3 but not its dependencies from c:	emppackages
    Install-Package Ninject.Mvc3 -IgnoreDependencies -Source c:	emppackages
    
    # Installs the package listed on the online packages.config into the current project
    # Note: the URL must end with "packages.config"
    Install-Package https://raw.githubusercontent.com/linked-data-dotnet/json-ld.net/master/.nuget/packages.config
    
    # Installs jquery 1.10.2 package, using the .nupkg file under local path of c:	emppackages
    Install-Package c:	emppackagesjQuery.1.10.2.nupkg
    
    # Installs the specific online package
    # Note: the URL must end with ".nupkg"
    Install-Package https://globalcdn.nuget.org/packages/microsoft.aspnet.mvc.5.2.3.nupkg
    • Uninstall-Package

    从项目中删除包, 并可以选择删除其依赖项。 如果其他包依赖于此包, 则该命令将失败, 除非指定了-Force 选项

    # Uninstalls the Elmah package from the default project
    Uninstall-Package Elmah
    
    # Uninstalls the Elmah package and all its unused dependencies
    Uninstall-Package Elmah -RemoveDependencies 
    
    # Uninstalls the Elmah package even if another package depends on it
    Uninstall-Package Elmah -Force
    • Update-Package

     将包及其依赖项或项目中的所有包更新到较新的版本

    # Updates all packages in every project of the solution
    Update-Package
    
    # Updates every package in the MvcApplication1 project
    Update-Package -ProjectName MvcApplication1
    
    # Updates the Elmah package in every project to the latest version
    Update-Package Elmah
    
    # Updates the Elmah package to version 1.1.0 in every project showing optional -Id usage
    Update-Package -Id Elmah -Version 1.1.0
    
    # Updates the Elmah package within the MvcApplication1 project to the highest "safe" version.
    # For example, if Elmah version 1.0.0 of a package is installed, and versions 1.0.1, 1.0.2,
    # and 1.1 are available in the feed, the -Safe parameter updates the package to 1.0.2 instead
    # of 1.1 as it would otherwise.
    Update-Package Elmah -ProjectName MvcApplication1 -Safe
    
    # Reinstall the same version of the original package, but with the latest version of dependencies
    # (subject to version constraints). If this command rolls a dependency back to an earlier version,
    # use Update-Package <dependency_name> to reinstall that one dependency without affecting the
    # dependent package.
    Update-Package ELmah –reinstall 
    
    # Reinstall the Elmah package in just MyProject
    Update-Package Elmah -ProjectName MyProject -reinstall
    
    # Reinstall the same version of the original package without touching dependencies.
    Update-Package ELmah –reinstall -ignoreDependencies
    • Sync-Package

    从指定的 (或默认的) 项目获取已安装包的版本, 并将该版本同步到解决方案中项目的其余部分

      

    # Sync the Elmah package installed in the default project into the other projects in the solution
    Sync-Package Elmah
    
    # Sync the Elmah package installed in the ClassLibrary1 project into other projects in the solution
    Sync-Package Elmah -ProjectName ClassLibrary1
    
    # Sync Microsoft.Aspnet.package but not its dependencies into the other projects in the solution
    Sync-Package Microsoft.Aspnet.Mvc -IgnoreDependencies
    
    # Sync jQuery.Validation and install the highest version of jQuery (a dependency) from the package source    
    Sync-Package jQuery.Validation -DependencyVersion highest
    • Get-Project 

    显示有关默认项目或指定项目的信息。 Get-Project特别返回对项目的 Visual Studio DTE (开发工具环境) 对象的引用。

     

    # Displays information for the default project
    Get-Project
    
    # Displays information for a project in the solution
    Get-Project MyProjectName
    
        # Displays information for all projects in the solution
    Get-Project -All
    SQL Server
  • 相关阅读:
    解决运行docker命令要用sudo的问题
    python3 http.server 本地服务支持跨域
    Linux 命令速记本
    截取某段时间内的日志
    centos7 安装postgresql10
    centos 7 安装 mail
    centos7 mail
    centos7 mysql 5.7 官网下载tar安装
    修改storm ui 默认端口
    redis-trib构建集群
  • 原文地址:https://www.cnblogs.com/zlgan/p/12129003.html
Copyright © 2011-2022 走看看