Есть ли способ заставить Visual Studio 2017 прекратить попытки извлекать пакет из Nuget.org и из канала TFS 2017? - PullRequest
0 голосов
/ 03 мая 2018

У нас есть пара внутренних пакетов nuget в локальной ленте TFS 2017. Они используются только нашими внутренними приложениями; однако, когда мы устанавливаем внешние пакеты, размещенные на 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 .
  • Я попытался установить из инструмента пользовательского интерфейса и только выбрав Nuget.org
  • Я искал в Google и Stack Overflow возможные проблемы с фидом TFS, но, похоже, не могу найти никого с этой проблемой.

Другие возможности

  • Я не уверен, что обновление нашего сервера TFS до TFS 2018 и использование исходного кода (у TFS 2017 нет nuget.org в качестве источника) также решит эту проблему, так как это, похоже, связано с тем, как Visual Studio получает и проверяет исходные коды. Мы не планируем делать это до 3-го квартала этого года, поэтому я хотел бы найти решение, отличное от переноса нашего канала из TFS 2017.

1 Ответ

0 голосов
/ 03 мая 2018

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.

Если вы хотите загрузить с определенного сервера, вы можете указать источник для установки этого пакета с помощью Параметры -Source :

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

В этом случае мы могли бы извлечь пакет Microsoft.Owin.Host.SystemWeb только из источника nuget.org, а не обнаружить все источники пакетов nuget.

Однако , если установленный пакет nuget имеет зависимости, NuGet обнаружит все источники пакетов, когда попытается собрать информацию о зависимостях. И это также поведение по умолчанию NuGet. Нам не нужно добавлять все пакеты зависимостей в пользовательский канал при установке пакета nuget.

Текущее решение заключается в том, что вы можете отключить ленту TFS 2017 при установке некоторых указанных пакетов (снимите флажок с источника пакета TFS 2017).

Для отслеживания основной проблемы NuGet я открываю ветку на Github , вы можете проверить эту ветку на последние отзывы.

Надеюсь, это поможет.

...