Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to filter nuget packages by supported platform?

Tags:

For example, if I want only packages for .Net Platform Standard. Now I am looking for a package, try to install it, getting:

error: Package <name> is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0).  Package <name> supports: portable-win81+wpa81 (.NETPortable,Version=v0.0,Profile=Profile32) error: One or more packages are incompatible with .NETCoreApp,Version=v1.0. 

and I have to start again. I see the supported platforms. That means, the info is there.

Edit: It will be better if I can set a filter in Visual Studio, but I do not see such, I have not seen it in nuget.org too. So the question is: Is there a way to get packages only for certain platform (that means filter by platform search for something). What I am interested in is .Net Platform Standard. I hope, you do not see something vague here.

Edit: Here is the search api from nuget.org

<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">     <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0" m:MaxDataServiceVersion="2.0">         <Schema xmlns="http://schemas.microsoft.com/ado/2006/04/edm" Namespace="NuGetGallery.OData">             <EntityType Name="V2FeedPackage" m:HasStream="true">...</EntityType>         </Schema>         <Schema xmlns="http://schemas.microsoft.com/ado/2006/04/edm" Namespace="NuGetGallery">             <EntityContainer Name="V2FeedContext" m:IsDefaultEntityContainer="true">                 <EntitySet Name="Packages" EntityType="NuGetGallery.OData.V2FeedPackage"/>                 <FunctionImport Name="Search" ReturnType="Collection(NuGetGallery.OData.V2FeedPackage)" EntitySet="Packages">                     <Parameter Name="searchTerm" Type="Edm.String" FixedLength="false" Unicode="false"/>                     <Parameter Name="targetFramework" Type="Edm.String" FixedLength="false" Unicode="false"/>                     <Parameter Name="includePrerelease" Type="Edm.Boolean" Nullable="false"/>                 </FunctionImport>                 <FunctionImport Name="FindPackagesById" ReturnType="Collection(NuGetGallery.OData.V2FeedPackage)" EntitySet="Packages">                     <Parameter Name="id" Type="Edm.String" FixedLength="false" Unicode="false"/>                 </FunctionImport>                 <FunctionImport Name="GetUpdates" ReturnType="Collection(NuGetGallery.OData.V2FeedPackage)" EntitySet="Packages">                     <Parameter Name="packageIds" Type="Edm.String" FixedLength="false" Unicode="false"/>                     <Parameter Name="versions" Type="Edm.String" FixedLength="false" Unicode="false"/>                     <Parameter Name="includePrerelease" Type="Edm.Boolean" Nullable="false"/>                     <Parameter Name="includeAllVersions" Type="Edm.Boolean" Nullable="false"/>                     <Parameter Name="targetFrameworks" Type="Edm.String" FixedLength="false" Unicode="false"/>                     <Parameter Name="versionConstraints" Type="Edm.String" FixedLength="false" Unicode="false"/>                 </FunctionImport>             </EntityContainer>         </Schema>     </edmx:DataServices> </edmx:Edmx> 

When I use Search function, the 'searchTerm' parameter works, but not the 'targetFramework' parameter.

Another Edit: VisualStudio NuGet HTTP request in Fiddler:

GET /api/v2/Search()?$filter=IsAbsoluteLatestVersion&searchTerm='mvv'&targetFramework='netcoreapp1.0'&includePrerelease=true&$skip=0&$top=26 HTTP/1.1 

The target framework is set automatically from Visual Studio NuGet Package Manager. What actually does not work is the targetFramework parameter in the search api from NuGet

like image 399
Mottor Avatar asked Jun 01 '16 11:06

Mottor


People also ask

How do I browse NuGet packages?

Load a project in Solution Explorer, and then select Project > Manage NuGet Packages. The NuGet Package Manager window opens. Select the Browse tab to display packages by popularity from the currently selected source (see Package sources). To search for a specific package, use the search box on the upper left.

What command can you use to search for a package in the NuGet package manager console?

Quickly find and install a package Open your project or solution in Visual Studio, and select Tools > NuGet Package Manager > Package Manager Console to open the Package Manager Console window. In the console, enter Find-Package with a keyword to find the package you want to install.

What is package Nuspec?

A . nuspec file is an XML manifest that contains package metadata. This manifest is used both to build the package and to provide information to consumers. The manifest is always included in a package.

Can I delete .NuGet packages?

Uninstall a NuGet packageIn Solution Explorer, right-click either the Solution, the desired project, or the References in the project, and then select Manage NuGet Packages. Select the package to uninstall (use search to filter the list if necessary), and then select Uninstall.


1 Answers

NuGet has option to target the framework as mentioned in here

There is an open feature request matching your scenario on github

I feel there might a possibility to attain your filtering using power shell console scripts as I came across this page. See the section "Getting the FrameworkName".

like image 100
Kesavan D Avatar answered Oct 16 '22 05:10

Kesavan D