如何找出缺失框架的依赖包信息 [英] How to figure out the information of dependency packages for missing frameworks

查看:52
本文介绍了如何找出缺失框架的依赖包信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我将 NuGet 包 DocumentFormat.OpenXml 添加到我的 C# 项目中.我的 C# 项目面向 .Net 框架 v4.5.在NuGet包管理器中显示NuGet包的依赖信息如下图:

Today I was adding a NuGet package DocumentFormat.OpenXml into my C# project. My C# project is targeting.Net framework v4.5. In NuGet package manager it shows the information of dependencies of the NuGet package as shown below:

没有对应.Net Framework v4.5的信息.那么,如果我的项目面向 .Net Framework v4.5,我该如何解释这些信息.是否缺少此信息或在这种情况下有任何默认假设可能没有依赖项.有人可以分享一些这方面的信息

There is no information corresponding to .Net Framework v4.5. So, how do I interpret this information if my project is targeting .Net Framework v4.5. Is this information missing or there is any default assumption in such cases may be no dependencies. Can someone share some information in this regard

注意:这个问题可能看起来像一个非编程问题,但我在写一行代码之前就被卡住了,所以在这个论坛上提问.

Note: This question might look like a non-programming question but I got stuck even before writing a single line of code so asking it in this forum.

推荐答案

.NET Frameworks 向后兼容.这意味着如果您的项目面向 v4.5,您可以使用较低版本的包,例如 v4.0、v3.5.

.NET Frameworks are backwards compatible. Meaning if your project is targeting v4.5, you can consume packages with lower versions, such as v4.0, v3.5.

NuGet 的专长是兼容性检查(如果包是正确编写的):)NuGet 知道可用的框架是 v3.5、v4.0、v4.6 和 netstandard1.3.与 v4.5最近的"兼容框架是 v4.0,因此它会在您安装时选择 v4.0 资产.

NuGet's specialty is compatibility checking (if packages are authored correctly ofc) :) NuGet knows the available frameworks are v3.5, v4.0, v4.6 and netstandard1.3. The "nearest" compatible framework with v4.5 is v4.0, so it'll pick the v4.0 assets when you install it.

所以答案是,它对您的情况没有依赖性.

So the answer, it has no dependencies in your case.

请注意,仅通过查看 nuget.org 上的 TFM,框架兼容性并不总是很明显,NuGet 将尝试不同的回退.

Please note that framework compatibility is not always apparent from just looking at the TFMs on nuget.org, there's different fallbacks that NuGet will attempt.

因此,确定依赖项的最佳方法是将其安装在项目中,因为如果您有其他依赖项,NuGet 可能需要解决冲突等问题.

So really the best way to figure out what the dependencies are would be to install it in the project, since NuGet might need to resolve conflicts etc. if you have other dependencies.

这篇关于如何找出缺失框架的依赖包信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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