zoukankan      html  css  js  c++  java
  • Nuget添加新项目的问题

    为已有的几个项目添加了一个nuget package 后,在解决方法中添加了一个新项目,然后想把这个nuget package添加到这个新建的项目中去,可以此时无法添加。

     

     

    怎么办那?

    【解决方法】

    There's 3 approaches :).
    In NuGet 1.1 (The latest release) we've improved powershell pipelining so you can do this:

    Get-Project -All | Install-Package SomePackage

    That will install "SomePackage" into all of your projects. You can use wildcards to narrow down which projects:

    Get-Project Mvc* | Install-Package SomePackage

    That will use wildcard semantics (in this case, find all projects that start with mvc).

    Get-Project SomeProject | Install-Package SomePackage

    That will install SomePackage into SomeProject and nothing else.

     

     

    如果在运行的时候出现如下的提示:

    <Project name> already has a reference to <Package>.

    那就检查一下项目的package.config文件,如果已经有了引用,就删掉。另外也看一下项目的references,如果有了,也删掉。

     

    如果在运行命令的时候,出现了如下的错误信息。

    Install-Package : An error occurred while loading packages

    from'https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/': The underlying connection was closed: Could not

    establish trust relationship for the SSL/TLS secure channel.

    At line:1 char:45

    + Get-Project NotesDataExporterCloud.Common | Install-Package Newtonsoft.Json

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException

    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

     

    原因是www.nuget.org的证书过期了,解决方法是添加自己的Package Source.

     

    注意machine-wide package sources 下面的checkbox一定要勾掉,不然的话运行命令的时候会用这个来链接Nuget,还是会报证书的错误。

     

  • 相关阅读:
    ServletDemo
    day12
    [转载]推荐不伤眼睛的文字背景色 VS背景色
    day11
    63.队列:1.    寻找经过结点最少的路径
    62.COUNT(递归算法)--数的划分变式题型
    62.COUNT(递归算法)--数的划分变式题型
    62.COUNT(递归算法)--数的划分变式题型
    60.(递推练习)黑白棋子
    60.(递推练习)黑白棋子
  • 原文地址:https://www.cnblogs.com/time-is-life/p/5619968.html
Copyright © 2011-2022 走看看