如何找出哪个 .NET 框架 nuget 包的目标? [英] How to find out which .NET framework nuget package targets?

查看:65
本文介绍了如何找出哪个 .NET 框架 nuget 包的目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 C# 项目必须面向 .NET 3.5.框架,我有几个 nuget 包我想安装在给定的项目中.

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.

对于给定的 nuget 包,如何找出它支持的 .NET 框架版本(例如通过包的版本),而不需要我尝试安装包的每个可用版本以查看其安装是否通过不会因为给定版本的包依赖高于 3.5 的 .NET 框架而回滚.?

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.?

例如,我知道 xUnit.net 版本 1.9.2.是支持 .NET 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".

推荐答案

无法评论上一个答案,但 packages.config 中的 targetFramework 属性是安装该包时项目的 .NET 版本.

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.

例如,我有两个项目使用 Newtonsoft.Json 9.0.1,这些是它们各自的 package.config 文件中的行:

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" />

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

这篇关于如何找出哪个 .NET 框架 nuget 包的目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆