简体   繁体   English

.NET 4.6.1项目引用的.NET Standard 2.0库-引用的图形库版本错误

[英].NET Standard 2.0 library referenced by .NET 4.6.1 project - Wrong version of Drawing library referenced

I am trying to get a .NET standard 2.0 library (that uses System.Drawing) to be referenced by a .NET 4.6.1 project (that implements a function that passes the ImageFormat enum). 我试图获得一个.NET标准2.0库(使用System.Drawing),以供.NET 4.6.1项目(该实现实现传递ImageFormat枚举的函数)引用。

I get the following error in the implementing project. 在实施项目中出现以下错误。

The type 'ImageFormat' is defined in an assembly that is not referenced. 类型“ ImageFormat”在未引用的程序集中定义。 You must add a reference to assembly 'System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. 您必须添加对程序集'System.Drawing.Common,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = cc7b13ffcd2ddd51'的引用。

The .NET standard 2.0 library includes the nuget package System.Drawing.Common 4.5.0 (which includes ImageFormat). .NET标准2.0库包括nuget包System.Drawing.Common 4.5.0(包括ImageFormat)。

The .NET 4.6.1 project references System.Drawing 4.0.0 (which also includes ImageFormat). .NET 4.6.1项目引用System.Drawing 4.0.0(还包括ImageFormat)。

4.5.0 vs 4.0.0 4.5.0和4.0.0

So the message makes sense... I am not referencing the correct version of System.Drawing in the .NET project! 因此,该消息很有意义...我没有在.NET项目中引用System.Drawing的正确版本!

But I can't work out what I need to do to resolve it. 但是我无法解决该问题。

Can anyone please help? 谁能帮忙吗?

I had a similar problem. 我有一个类似的问题。 I couldnt use anything from .netCore and i had a similar error message and what i did was to right click to the solution and to open the nuget manager and to install the .netCore manualy and it worked. 我无法使用.netCore的任何内容,并且收到类似的错误消息,我所做的是右键单击该解决方案并打开nuget管理器并手动安装.netCore,此方法可以正常工作。 Try it and see if it works. 试试看,看看是否可行。 Greetings! 问候!

暂无
暂无

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

相关问题 将 class 库项目升级到 .net 标准 2.1,其中 .net 框架 4.X 项目已引用该标准 - Upgrading class library project to .net standard 2.1 where this has been referenced by .net framework 4.X projects netstandard2.0(.net standard 2.0)类库不能引用net461(.net framework 4.6.1)类库 - netstandard2.0 (.net standard 2.0) class library cannot reference a net461 (.net framework 4.6.1) class library 无法在引用 .Net 标准库的已发布 .Net 4.6.1 项目中加载文件或程序集“System.ComponentModel.Annotations” - Could not load file or assembly 'System.ComponentModel.Annotations' in published .Net 4.6.1 project referencing .Net Standard library .NET 462 项目引用时,bin 中缺少 .NET Standard 2.0 dll 的瞬态依赖项 - Transient dependencies of .NET Standard 2.0 dll are missing in bin when referenced by .NET 462 project 如何禁止引用.NET DLL类库 - How to forbid a .NET DLL class library to be referenced Serilog Seq 包未安装在 .NET Standard 2.0 库项目上 - Serilog Seq package does not install on .NET Standard 2.0 library project 在库中使用.Net Standard 1.4并在应用程序中使用.Net Framework 4.6.1时,无法加载文件System.IO.FileSystem,版本= 4.0.1.0 - When using .Net Standard 1.4 in a library and .Net framework 4.6.1 in and application, unable to load file System.IO.FileSystem, Version=4.0.1.0 .net 标准 2.0 库中的 EF Core DbContext - EF Core DbContext in .net standard 2.0 library 在 NET Framework 4.8 项目中引用 NET Standard 2.0 库 - 性能问题? - Referencing a NET Standard 2.0 library in a NET Framework 4.8 Project - Performance Issues? .NET Framework 4.6.1应用程序具有引用.NET Standard 1.4类库的错误 - .NET Framework 4.6.1 application has errors referencing .NET Standard 1.4 class library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM