无法添加System.Drawing.dll参考 [英] can't add System.Drawing.dll reference
问题描述
好吧,所以我在过去的4个小时中一直在研究此错误,我不知道该怎么办.
Ok, so I'm on this bug for the last 4 hours and I dont know what to do..
我正在使用Visual Studio Community 2017,并且打开了Consol App(.net core)项目.我也在Windows 8.1操作系统上工作.
I'm using Visual Studio Community 2017 and I opened Consol App(.net core) project. also I'm working on windows 8.1 OS.
我想使用System.Drawing命名空间中的Image,它一直给我这个错误: 找不到类型或名称空间名称'Image'(您是否缺少using指令或程序集引用?)"
I wanted to use Image from the System.Drawing namespace and it keeps giving me that error: "the type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)"
我从 https://www.dllme下载了System.Drawing.dll. com/dll/files/system_drawing_dll.html (到桌面),然后右键单击右侧的项目->添加->参考..->浏览..-> System.Drawing.dll->确定 然后我在项目(在解决方案资源管理器中)的项目依赖项-> Assemblies-> System.Drawing中看到了,所以我猜它正常吗?!
I downloaded the System.Drawing.dll from https://www.dllme.com/dll/files/system_drawing_dll.html (to the desktop) and then right click on the right project->add->Reference..->Browse..->System.Drawing.dll->OK then I saw in the project (in the Solution Explorer) in the project dependencies->Assemblies->System.Drawing so I guess it works right?!
我仍然遇到相同的错误,无法使用System.Drawing命名空间,有任何建议吗?
I'm still getting the same error and can't use the System.Drawing namespace, any suggestions?
using System;
using System.Net.Sockets;
using System.Drawing;
namespace client2
{
class Program
{
static void Main(string[] args)
{
try
{
//read image
Image image = new Image("C:\\image\\amir.jpg");
}
}
}
}
推荐答案
System.Drawing
不属于.NET Core.这取决于Windows附带的GDI +.有很多其他选择.
System.Drawing
is not part of .NET Core. It depends on GDI+ which is part of Windows. There are plenty of alternatives out there.
在旁边:切勿从不受信任的来源下载DLL.
Aside: Never download DLLs from an untrusted source.
这篇关于无法添加System.Drawing.dll参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!