简体   繁体   English

项目“ ClassLibrary1.csproj”的目标是“ netstandard2.1”。 面向'.NETFramework,Version = v4.8'的项目无法引用它

[英]Project 'ClassLibrary1.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.8'

I have some class library projects in targets netstandard2.1 . 我在目标netstandard2.1有一些类库项目。

When I referenced that to my WPF project in target .NET Framework v4.8 , On building time I get an error: 当我在目标.NET Framework v4.8引用我的WPF项目时,在构建时出现错误:

Severity Code Description Project File Line Suppression State Error Project '..\\ClassLibrary1\\ClassLibrary1.csproj' targets 'netstandard2.1'. 严重性代码说明项目文件行抑制状态错误项目'.. \\ ClassLibrary1 \\ ClassLibrary1.csproj'目标为'netstandard2.1'。 It cannot be referenced by a project that targets '.NETFramework,Version=v4.8'. 面向'.NETFramework,Version = v4.8'的项目无法引用它。 WpfApp1 WpfApp1

What can I do? 我能做什么?

Update: I read this Q/A about referencing netcoreapp2.1 and in that answer telling about add netstandar2.1 . 更新:我读这个 Q / A有关引用netcoreapp2.1在这个问题的答案讲述添加netstandar2.1 But my libraries are already in targets netstandard2.1 ! 但是我的库已经在目标netstandard2.1

What can I do? 我能做什么?

  1. If your library desn't need the very latest features, use .net standard 2.0 如果您的库不需要最新功能,请使用.net standard 2.0
    in general a library should aim to support the lowest possible version. 通常,库应旨在支持最低版本。

or 要么

  1. port your WPF app to .NET Core 3 (preview) 将您的WPF应用移植到.NET Core 3(预览版)

According to the compatibility matrix , my NetFramework 4.8 project should not be able to reference libraries up to NetStandard 2. So the @Henk Holterman answer is true. 根据兼容性矩阵 ,我的NetFramework 4.8项目应该不能引用NetStandard 2之前的库。因此, @Henk Holterman回答是正确的。

The versions listed here represent the rules that NuGet uses to determine whether a given .NET Standard library is applicable. 此处列出的版本代表NuGet用于确定给定.NET标准库是否适用的规则。

.NET Framework will not support .NET Standard 2.1 or any other later version. .NET Framework将不支持.NET Standard 2.1或任何其他更高版本。 For more details, see this blog post . 有关更多详细信息,请参阅此博客文章

暂无
暂无

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

相关问题 项目“ClassLibrary1.csproj”针对“netcoreapp2.1”。 它不能被以“.NETFramework,Version=v4.7.2”为目标的项目引用 - Project 'ClassLibrary1.csproj' targets 'netcoreapp2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2' 项目“ClassLibraryX.csproj”针对“netstandard2.1”。 它不能被以“.NETFramework,Version=v4.7.2”为目标的项目引用 - Project 'ClassLibraryX.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2 Project X的目标是'.NETStandard,Version = v1.6'。 它不能被针对'.NETFramework,Version = v4.6.1'的项目引用 - Project X targets '.NETStandard,Version=v1.6'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.6.1' DalvikUWPCSharp.csproj 的目标是 'UAP,Version=v10.0.18362'。 它不能被以 '.NETCore,Version=v5.0' 为目标的项目引用 - DalvikUWPCSharp.csproj' targets 'UAP,Version=v10.0.18362'. It cannot be referenced by a project that targets '.NETCore,Version=v5.0' 如何使用 TargetFramework=netstandard2.1 创建类库? - How to create a classlibrary with TargetFramework=netstandard2.1? Project xxx与netcoreapp2.2(.NETCoreApp,Version = v2.2)不兼容。 Project xxx支持:net48(.NETFramework,Version = v4.8) - Project xxx is not compatible with netcoreapp2.2 (.NETCoreApp,Version=v2.2). Project xxx supports: net48 (.NETFramework,Version=v4.8) dotnet 运行报告 '.NETFramework,Version=v4.8 未找到' - dotnet run reporting '.NETFramework,Version=v4.8 were not found' 您正在尝试将此 package 安装到以“.NETFramework,Version=v4.7.2”为目标的项目中 - You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.2' netstandard2.1 版本的 CancellationTokenRegistration.Unregister() - netstandard2.1 version of CancellationTokenRegistration.Unregister() 启动项目“xxx”针对框架“.NETStandard” - Startup project 'xxx' targets framework '.NETStandard'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM