简体   繁体   English

如何确定特定 NuGet 包所需的 .NET Framework?

[英]How do I determine .NET Framework needed for a particular NuGet package?

Using Nuget Package Manager in Visual Studio 2019 I attempted to install Microsoft.Toolkit.Uwp.UI.Controls and was met with this message/error:在 Visual Studio 2019 中使用 Nuget 包管理器我尝试安装 Microsoft.Toolkit.Uwp.UI.Controls 并遇到此消息/错误:

"Could not install package 'Microsoft.Toolkit.Uwp.UI.Controls 6.1.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.8', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author." “无法安装包‘Microsoft.Toolkit.Uwp.UI.Controls 6.1.1’。您正在尝试将此包安装到面向‘.NETFramework,Version=v4.8’的项目中,但该包不包含任何与该框架兼容的程序集引用或内容文件。有关更多信息,请联系包作者。”

Unfortunately, I probably can't change the .NETFramework version (it's a shared project).不幸的是,我可能无法更改 .NETFramework 版本(这是一个共享项目)。 However, it occurred to me that an earlier version of Microsoft.Toolkit.Uwp.UI.Controls might work just fine.但是,我突然想到 Microsoft.Toolkit.Uwp.UI.Controls 的早期版本可能会正常工作。 But how does one determine which version of .NETFramework a particular version of Microsoft.Toolkit.Uwp.UI.Controls requires?但是如何确定特定版本的 Microsoft.Toolkit.Uwp.UI.Controls 需要哪个版本的 .NETFramework? I suppose I could just start trying them and see what happens but that seems like a lot of work.我想我可以开始尝试它们,看看会发生什么,但这似乎需要做很多工作。 Even if I do that, it's not clear how you figure out what version of .NETFramework it uses.即使我这样做,也不清楚您如何确定它使用的 .NETFramework 版本。 This answer How to find out which .NET framework nuget package targets?这个答案如何找出哪个 .NET 框架 nuget 包的目标? , suggested looking in packages.config but all I see in that is: ,建议查看packages.config,但我看到的是:

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.37.0" />
</packages>

I'm doing all this because I'm trying to get a radial progress bar.我这样做是因为我试图获得一个径向进度条。 See How do I code a Radial Progress Bar for WPF/C# app请参阅如何为 WPF/C# 应用程序编写径向进度条

Thanks, Dave谢谢,戴夫

Update, there is some information about Dependencies at the bottom of the Nuget Package Manager, as Michel pointed out.更新,正如 Michel 指出的那样,Nuget 包管理器底部有一些关于依赖项的信息。 However, in my case, no mention is made of .NETFramework.但是,就我而言,没有提及 .NETFramework。 See picture:见图片: 在此处输入图片说明

You can see the dependencies at the bottom om the info pane, in the NuGet package manager.您可以在 NuGet 包管理器的信息窗格底部看到依赖项。 The particular package you have chosen seem to be only for UWP apps, hence it depends on UAP.您选择的特定包似乎仅适用于 UWP 应用程序,因此它取决于 UAP。

Nuget 包管理器


For packages requiring other frameworks it might look like this:对于需要其他框架的包,它可能如下所示:

其他依赖

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM