can't add System.Drawing.dll reference

邮差的信 提交于 2019-12-02 03:22:38

问题


Ok, so I'm on this bug for the last 4 hours and I dont know what to do..

I'm using Visual Studio Community 2017 and I opened Consol App(.net core) project. also I'm working on windows 8.1 OS.

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?)"

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?!

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");
        }
    }
}

}


回答1:


System.Drawing is not part of .NET Core. It depends on GDI+ which is part of Windows. There are plenty of alternatives out there.

Aside: Never download DLLs from an untrusted source.



来源:https://stackoverflow.com/questions/49910014/cant-add-system-drawing-dll-reference

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!