How to figure out the information of dependency pa

2019-08-20 15:41发布

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:

enter image description here

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.

1条回答
做个烂人
2楼-- · 2019-08-20 16:19

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

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.

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.

查看更多
登录 后发表回答