如何在使用“.NETFramework,Version=v4.5.2"的项目中安装 System.Drawing.Common? [英] How do I install System.Drawing.Common in a project that uses '.NETFramework,Version=v4.5.2'?

查看:61
本文介绍了如何在使用“.NETFramework,Version=v4.5.2"的项目中安装 System.Drawing.Common?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在.NETFramework,Version=v4.5.2"应用程序中用 C# 编写一些单元测试,但所有测试都给出了下一个错误:

I am trying to write some unit tests in C# in a '.NETFramework,Version=v4.5.2' application but all tests give the next error:

'System.IO.FileNotFoundException : 无法加载文件或程序集'System.Drawing.Common,版本=0.0.0.0,文化=中性,PublicKeyToken=cc7b13ffcd2ddd51'.系统找不到文件指定.'

'System.IO.FileNotFoundException : Could not load file or assembly 'System.Drawing.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'

当我尝试安装 System.Drawing.Common 时,我从 NuGet 包中收到下一个错误:

When I try to install System.Drawing.Common I get the next error from the NuGet package:

无法安装包System.Drawing.Common 4.5.1".您正在尝试将此包安装到针对'.NETFramework,Version=v4.5.2',但该包不包含任何与该框架兼容的程序集引用或内容文件.更多信息,请联系软件包作者.

Could not install package 'System.Drawing.Common 4.5.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', 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.

我无法更改应用程序版本或框架 (.NET Core 2.1),而且我在网上发现的任何其他技巧都不起作用(或产生了更多错误).

I cannot change the application version or the framework (.NET Core 2.1) and any other trick I found online did not work (or generated more errors).

帮助?

推荐答案

在 NuGet 中放置这一行:安装包 System.Drawing.Common -Version 4.5.2

in NuGet put this line : Install-Package System.Drawing.Common -Version 4.5.2

在 .NET CLI 中:dotnet 添加包 System.Drawing.Common --version 4.5.2

in .NET CLI put : dotnet add package System.Drawing.Common --version 4.5.2

在 Paket CLI 中输入:包添加 System.Drawing.Common --version 4.5.2

in Paket CLI put : paket add System.Drawing.Common --version 4.5.2

这篇关于如何在使用“.NETFramework,Version=v4.5.2"的项目中安装 System.Drawing.Common?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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