Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out which .NET framework nuget package targets?

I have C# project that has to target .NET 3.5. framework and I have several nuget packages I'd like to install in the given project.

How to find out, for a given nuget package, which .NET framework versions it supports (by version of package for example), without me trying to install every available version of the package in order to see if its installation will pass without rolling back because of the dependency of the given version of the package to .NET framework higher than 3.5.?

For example, I know that xUnit.net version 1.9.2. is the highest version that supports .NET 3.5, but I had to find out this "manually".

like image 666
dragan.stepanovic Avatar asked Aug 13 '15 07:08

dragan.stepanovic


People also ask

How do I check my NuGet target framework?

You can download the . nupkg file (https://www.nuget.org/packages > Download ) then unzip it. In the file you can find references to PlatformToolset, ToolsVersion which I was able to use to look up the specific version of the compiler.


2 Answers

Cannot comment on the previous answer, but the targetFramework attribute in packages.config is the .NET version of the project at the time that package was installed.

For example, I have two projects that use Newtonsoft.Json 9.0.1, and these are the lines in their respective packages.config files:

  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" /> 

and

  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net462" /> 
like image 158
Timothy Avatar answered Oct 03 '22 05:10

Timothy


packages.config should give you the version info

example

<package id="xunit" version="2.2.0-beta1-build3239" targetFramework="net46" />   <package id="xunit.abstractions" version="2.0.0" targetFramework="net46" />   <package id="xunit.assert" version="2.2.0-beta1-build3239" targetFramework="net46" />   <package id="xunit.core" version="2.2.0-beta1-build3239" targetFramework="net46" />   <package id="xunit.extensibility.core" version="2.2.0-beta1-build3239" targetFramework="net46" />   <package id="xunit.extensibility.execution" version="2.2.0-beta1-build3239" targetFramework="net46" />   <package id="xunit.runner.msbuild" version="2.2.0-beta1-build3239" targetFramework="net46" developmentDependency="true" />   <package id="xunit.runner.visualstudio" version="2.2.0-beta1-build1144" targetFramework="net46" developmentDependency="true" /> 
like image 29
Lucky Star Avatar answered Oct 03 '22 04:10

Lucky Star