简体   繁体   English

如何使用Nuget.VisualStudio从存储库中获取软件包列表

[英]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: 以下是一些更有用的博客文章:

Check the similar thread for some more details. 检查类似的线程以获取更多详细信息。

Hope this helps. 希望这可以帮助。

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

相关问题 使用Nuget.VisualStudio安装NuGet包时如何生成绑定重定向? - How do I generate binding redirects when using Nuget.VisualStudio to install a NuGet package? 如何使用 C# 从 Azure Devops 中的 Artifacts/Nuget Feed 获取所有包及其版本的列表? - How to get the list of all the packages with their versions from Artifacts/Nuget Feed in Azure Devops using C#? VisualStudio Online并打包Nuget包 - VisualStudio Online and pack Nuget packages 使用Teamcity REST API,如何使用teamcity rest API获取nuget软件包列表? - Using Teamcity REST API, how to get list of nuget packages using teamcity rest API? 如何获取通过 MSBuild 宏安装的 nuget 包列表? - How to get a list of nuget packages installed via MSBuild macro? .Net / VisualStudio如何处理具有相同nuget包的项目依赖项,每个项目具有不同的nuget目标 - How .Net/VisualStudio handles having projects dependencies each with different nuget target for same nuget packages 如何列出所有已安装的 NuGet 包? - How do I list all installed NuGet packages? 获取解决方案中使用的所有 NuGet 包的列表 - Get a list of all NuGet packages used in a solution 如何抑制nuget包中“垃圾”的产生? - How can I suppress the generation of 'trash' from nuget packages? 如何从引用的NuGet程序包中正确选择程序集? - How do I properly choose assemblies from referenced NuGet packages?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM