[英]VSTS package feed not pulling packages from upstream source (nuget.org)
I have setup a new team project on VSTS for our development team and am using the Package-Management
extension for publishing our NuGet packages.我已经为我们的开发团队在 VSTS 上设置了一个新的团队项目,并且正在使用
Package-Management
扩展来发布我们的 NuGet 包。 I have also enabled the public nuget.org
feed as an upstream source for our internal package feed.我还启用了公共
nuget.org
提要作为我们内部包提要的上游源。
As recommended here & here I have unchecked nuget.org as a package source within Visual Studio.按照此处和此处的建议,我已取消选中 nuget.org 作为 Visual Studio 中的包源。
Now I expect the search to find packages published to this feed first and if not then fetch it from the upstream.现在我希望搜索首先找到发布到此提要的包,如果没有,则从上游获取它。 But this is not the case and am unable to add packages from nuget.org unless I enable nuget.org as a package source from within Visual Studio.
但事实并非如此,除非我在 Visual Studio 中启用 nuget.org 作为包源,否则我无法从 nuget.org 添加包。
Packages from nuget.org (that where added by enabling nuget.org) start appearing in my private feed once I publish packages to my feed.(even after I uncheck nuget.org source) But I can't consume new packages directly from the upstream without enabling nuget.org as a source.一旦我将包发布到我的提要,来自 nuget.org 的包(通过启用 nuget.org 添加的包)开始出现在我的私人提要中。(即使在我取消选中 nuget.org 源之后)但我不能直接从上游而不启用 nuget.org 作为源。
Have I misunderstood this is this supposed to be a build machine configuration rather than a developer machine configuration?我是否误解了这应该是构建机器配置而不是开发机器配置?
You missed this section in the documentation :您错过了文档中的这一部分:
If you're using upstream sources, package-versions in the upstream source that haven't yet been saved into your feed (by using them at least once) won't appear in the NuGet Package Manager search.
如果您使用的是上游源,则上游源中尚未保存到源中的包版本(至少使用一次)将不会出现在 NuGet 包管理器搜索中。 To install these packages:
要安装这些软件包:
- On the upstream source (eg nuget.org), copy the Install-Package command.
在上游源(例如 nuget.org)上,复制 Install-Package 命令。
- In Visual Studio, open the Package Manager Console from Tools -> NuGet Package Manager.
在 Visual Studio 中,从工具 -> NuGet 包管理器打开包管理器控制台。
- Paste the Install-Package command into the Package Manager Console and run it.
将 Install-Package 命令粘贴到包管理器控制台中并运行它。
In Visual Studio (I'm using VS 2019), updated versions of packages from upstream should appear in the dropdowns automatically, except in the following case:在 Visual Studio 中(我使用的是 VS 2019),来自上游的包的更新版本应该会自动出现在下拉列表中,以下情况除外:
If PackageA
depends on PacakageB
, but PackageB
is not explicitly installed (ie you didn't add it explicitly in your project's Manage NuGet Packages
page), then PackageB
will be frozen at the last version that was implicitly installed.如果
PackageA
依赖于PacakageB
,但PackageB
未显式安装(即您没有在项目的Manage NuGet Packages
页面中显式添加它),则PackageB
将冻结在隐式安装的最后一个版本。
Example:示例:
On your Manage NuGet Packages
page you install System.Text.Json
version 5.0.0.在“
Manage NuGet Packages
页面上,安装System.Text.Json
5.0.0 版。 This causes your app to be implicitly dependent on System.Text.Encodings.Web
5.0.0.这会导致您的应用隐式依赖
System.Text.Encodings.Web
5.0.0。
Some time later, you upgrade System.Text.Json
to version 5.0.1.一段时间后,您将
System.Text.Json
升级到 5.0.1 版。 There is also a new version 5.0.1 of System.Text.Encodings.Web
, but since System.Text.Json
5.0.1 depends on System.Text.Encodings.Web
>= 5.0.0, the version already in your feed satisfies the implicit dependency.还有一个
System.Text.Encodings.Web
的新版本 5.0.1,但由于System.Text.Json
5.0.1 依赖于System.Text.Encodings.Web
>= 5.0.0,您的提要中已有的版本满足隐式依赖。 Your feed will keep version 5.0.0.您的提要将保留版本 5.0.0。
Sometime later you need to update to System.Text.Encodings.Web
version 5.0.1.稍后您需要更新到
System.Text.Encodings.Web
版本 5.0.1。 You search for System.Text.Encodings.Web
on the NuGet package page, but notice that version 5.0.0 is the only version available!您在 NuGet 包页面上搜索
System.Text.Encodings.Web
,但请注意版本 5.0.0 是唯一可用的版本!
Solution解决方案
4.1. 4.1. Click Install on version 5.0.0.
单击在 5.0.0 版上安装。 This will make the package an explicit dependency.
这将使包成为显式依赖项。
4.2. 4.2. Now, on the updates tab, you will see 5.0.1 appear as an update option.
现在,在更新选项卡上,您将看到 5.0.1 作为更新选项出现。
As you found, you do should also select nuget.org package source (both select you VSTS feed and nuget.org as package sources).如您所见,您还应该选择 nuget.org 包源(都选择您的 VSTS 提要和 nuget.org 作为包源)。
If you un-select nuget.org package source in VS, that means packages from nuget.org won't be available.如果您在 VS 中取消选择 nuget.org 包源,则意味着来自 nuget.org 的包将不可用。
For the purpose to search a package from VSTS feed first, and then search in nuget.org, you can achieve it by filtering packages from different package sources:为了先从VSTS提要中搜索包,然后在nuget.org中搜索,您可以通过过滤来自不同包源的包来实现:
To search a package (such as NUnit package) from VSTS feed (the name is new for below example) first:首先从 VSTS 提要搜索包(例如 NUnit 包)(以下示例的名称是新的):
Sepecifying Package source as new, if there shows the related package(s) in browse list, then you can use the package(s) from VSTS feed.将包源指定为新的,如果浏览列表中显示相关包,则您可以使用来自 VSTS 源的包。 If there has no packages list, that means VSTS feed does not have related packages, then you can serarch from nuget.org as below step.
如果没有包列表,这意味着 VSTS 提要没有相关的包,那么你可以从 nuget.org 搜索如下步骤。
To serach the package (NUnit) from nuget.org, you just need to change the package source as nuget.org, then VS will list related packages which store in https://api.nuget.org/v3/index.json .要从 nuget.org 搜索包 (NUnit),您只需将包源更改为 nuget.org,然后 VS 将列出存储在https://api.nuget.org/v3/index.json中的相关包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.