繁体   English   中英

有没有办法告诉Visual Studio 2017停止尝试从Nuget.org和TFS 2017提要中检索包?

[英]Is there a way to tell Visual Studio 2017 to stop trying to retrieve a package from both Nuget.org and a TFS 2017 feed?

本地TFS 2017 feed中有几个内部nuget包。 它们仅由我们的内部应用程序使用; 但是,当我们安装外部nuget.org托管程序包时,Visual Studio试图从内部源和nuget.org中都检索它们,并且要花很多时间才能安装程序包。 有什么办法告诉它从特定服务器下载吗?

这是我尝试在程序包管理器控制台中安装Microsoft.Owin.Security.OpenIdConnect的部分列表:

PM> Install-Package Microsoft.Owin.Host.SystemWeb -verbose
  GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.host.systemweb/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.host.systemweb/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.host.systemweb/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.host.systemweb/index.json 61ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.host.systemweb/index.json 60ms
  OK https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.host.systemweb/index.json 143ms
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.host.systemweb/index.json


Attempting to gather dependency information for package 'Microsoft.Owin.Host.SystemWeb.4.0.0' with respect to project 'WebAppName.Web', targeting '.NETFramework,Version=v4.5.1'
Package Microsoft.Owin.Host.SystemWeb from source NuGet official package source gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source nuget.org gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source Local Source gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source OurCustomFeed gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source Microsoft Visual Studio Offline Packages gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source OurCustomFeed Repo gathered from cache.
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/owin/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/owin/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/owin/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.security/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.security.cookies/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.security/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security.cookies/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security.cookies/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.security.cookies/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/owin/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security.openidconnect/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.security.openidconnect/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security.openidconnect/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/system.identitymodel.tokens.jwt/index.json
  GET https://api.nuget.org/v3/registration3-gz-semver2/system.identitymodel.tokens.jwt/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/system.identitymodel.tokens.jwt/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.security.openidconnect/index.json
  GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.identitymodel.logging/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security/index.json 62ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/owin/index.json 64ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/owin/index.json 76ms
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.logging/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.logging/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.identitymodel.protocols/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocols/index.json
  OK https://api.nuget.org/v3/registration3-gz-semver2/system.identitymodel.tokens.jwt/index.json 41ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin/index.json 72ms
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.identitymodel.protocols/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security/index.json 93ms
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocols/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security.cookies/index.json 86ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security.cookies/index.json 93ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security.openidconnect/index.json 90ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin/index.json 99ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.owin.security.openidconnect/index.json 80ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/system.identitymodel.tokens.jwt/index.json 76ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/system.identitymodel.tokens.jwt/index.json 67ms
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/system.identitymodel.tokens.jwt/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocols.openidconnect/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.identitymodel.protocols.openidconnect/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.tokens/index.json
  GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.identitymodel.tokens/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocols.openidconnect/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.tokens/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.logging/index.json 67ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocols/index.json 59ms
  GET https://api.nuget.org/v3/registration3-gz-semver2/newtonsoft.json/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.logging/index.json 69ms
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/newtonsoft.json/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/newtonsoft.json/index.json
  CACHE https://api.nuget.org/v3/registration3-gz-semver2/microsoft.identitymodel.protocols.openidconnect/index.json
  GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.identitymodel.protocol.extensions/index.json
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocol.extensions/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocols/index.json 64ms
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocol.extensions/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocols.openidconnect/index.json 51ms
  GET https://api.nuget.org/v3/registration3-gz-semver2/product.utilities/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.tokens/index.json 64ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.protocols.openidconnect/index.json 56ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/microsoft.identitymodel.tokens/index.json 54ms
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/product.utilities/index.json
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/newtonsoft.json/index.json 52ms
  NotFound http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/newtonsoft.json/index.json 51ms
  GET http://tfs.company.com/tfs/TfsRep/_packaging/18c3561d-f194-4914-90e2-9506ea56646c/nuget/v3/registrations2/product.utilities/index.json
  GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.aspnet.webapi.client/index.json
  GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.owin.security/index.json

... Hundreds of more similiar calls ....

请注意,每个文件如何涉及到对我们公司的TFS 2017服务器(tfs.company.com)以及对Nuget服务器(api.nuget.org)的调用。

我尝试过的事情:

  • 我认为这可能与解决方案级别的nuget.config文件有关,但我已将其删除,但这种情况仍然会发生。
  • 我浏览了nuget.config设置
  • 我尝试从UI工具安装,仅选择Nuget.org
  • 我已经在Google和Stack Overflow中搜索了可能的TFS Feed问题,但似乎找不到任何遇到此问题的人。

其他可能性

  • 我不确定是否将TFS服务器升级到TFS 2018并使用上游源(TFS 2017没有nuget.org作为源)是否可以解决此问题,因为这似乎与Visual Studio获取和检查的方式有关nuget源。 我们不打算在今年第三季度之前这样做,所以我想找到一种解决方案,而不是将我们的提要移出TFS 2017。

Visual Studio试图从内部源文件和nuget.org中检索它们,并且花费大量时间来安装软件包。 有什么办法告诉它从特定服务器下载吗?

这是NuGet的默认行为。 当我们在项目中安装NuGet软件包时,NuGet 3.0+将向所有NuGet源发送多任务请求,以便我们可以更有效地获取反馈。

这就是在输出日志中发出以下请求的原因:

Package Microsoft.Owin.Host.SystemWeb from source NuGet official package source gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source nuget.org gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source Local Source gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source OurCustomFeed gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source Microsoft Visual Studio Offline Packages gathered from cache.
Package Microsoft.Owin.Host.SystemWeb from source OurCustomFeed Repo gathered from cache.

如果要从特定的服务器下载,则可以通过Parameters -Source指定特定的源来安装此软件包:

Install-Package Microsoft.Owin.Host.SystemWeb -verbose -source nuget.org

在这种情况下,我们只能从源nuget.org检索包Microsoft.Owin.Host.SystemWeb,而不是检测所有nuget包源。

但是 ,如果已安装的nuget软件包具有依赖关系,则NuGet在尝试收集依赖关系信息时将检测到所有软件包源。 这也是NuGet的默认行为。 安装nuget程序包时,无需将所有依赖程序包添加到自定义Feed中。

当前的解决方法是,当您安装某些指定的软件包时,您将无法使用TFS 2017 Feed(取消选中TFS 2017软件包源)。

为了跟踪潜在的NuGet问题,我在Github上打开了一个线程,您可以检查该线程以获得最新反馈。

希望这可以帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM