[英]Using Nuget.VisualStudio how would I get a list of packages from a repository
When using the Nuget.VisualStudio Nuget package how do I get a list of package to allow the user to choose one to install? 使用Nuget.VisualStudio Nuget软件包时,如何获取软件包列表以允许用户选择要安装的软件包?
I am migrating a vsix project that was built against the Visual Studio 2013 Nuget API to use the API for Visual Studio 2017. I am using this documentation to setup the Nuget service which has the following warning. 我正在迁移针对Visual Studio 2013 Nuget API构建的vsix项目,以使用Visual Studio 2017的API。我正在使用此文档来设置具有以下警告的Nuget服务。
Do not use any other types besides the public interfaces in your code, and do not reference any other Nuget assemblies, including NuGet.Core.dll.
除了代码中的公共接口外,不要使用任何其他类型,也不要引用任何其他Nuget程序集,包括NuGet.Core.dll。
The Visual Studio 2013 vsix project used Nuget.Core to get the list of packages that could be installed. Visual Studio 2013 vsix项目使用Nuget.Core获取可以安装的软件包列表。 Unfortunately when I add Nuget.Core there are a ton of namespace collisions.
不幸的是,当我添加Nuget.Core时,会有大量的命名空间冲突。 This is the code we are using from the Nuget.Core package which I need to find an equivalent to in the new Nuget API.
这是我们从Nuget.Core包中使用的代码,我需要在新的Nuget API中找到与之等效的代码。
IPackageRepository repo = PackageRepositoryFactory.Default.CreateRepository("http://ourfeed.net/nuget");
List<IPackage> packages = repo.GetPackages().Where(p => p.Tags.Contains(tag))
.OrderByDescending(p => p.Version)
.Take(packagesPerTag).ToList();;
Using Nuget.VisualStudio how would I get a list of packages from a repository
如何使用Nuget.VisualStudio从存储库中获取软件包列表
According to the NuGet/NuGet2 : 根据NuGet / NuGet2 :
NuGet2
NuGet2
This is the home of nuget.core and all the repos from codeplex.
这是nuget.core和codeplex所有回购的所在地。 This repository is for Version 2 of NuGet.
该存储库适用于NuGet的版本2。 Version 3 of the Nuget client library has moved to Nuget.Client .
Nuget客户端库的版本3已移至Nuget.Client 。 See the NuGet API v3 documentation for more information.
有关更多信息,请参阅NuGet API v3文档。
See the NuGet API v3 documentation for more information NuGet Client SDK: 有关更多信息,请参阅NuGet API v3文档。
https://docs.microsoft.com/en-us/nuget/reference/nuget-client-sdk https://docs.microsoft.com/en-us/nuget/reference/nuget-client-sdk
And below are some blog posts that are more useful: 以下是一些更有用的博客文章:
Exploring the NuGet v3 Libraries, Part 2: Searching for packages 探索NuGet v3库,第2部分:搜索软件包
Exploring the NuGet v3 Libraries, Part 3: Installing packages 探索NuGet v3库,第3部分:安装软件包
Check the similar thread for some more details. 检查类似的线程以获取更多详细信息。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.