System.Drawing does not exist?

62,299

Solution 1

I suspect that you added the System.Drawing reference to the wrong project. Please verify that the Validator.cs file in the project that has the System.Drawing reference.

Solution 2

You can add referrence 'System.Drawing.dll' to your project.

enter image description here

Solution 3

I had the same issue and solved it, click on the project menu, then Add reference, reference manager will open, then click on the assemblies tab, search for System.Drawing and check it then press ok. it will recognize the package or name space.

Solution 4

I stumbled this error even referencing assembly. After thinking i realised that that error produced after adding a class file which is under 'System' folder which i produced on the project folder. That class has ##.System.## namespace as well under the folder. .Net produced error if you have any custom namespace which contains 'System' keyword. Try changing folder name and namespace if u stumbled as well.

Solution 5

Click on the Project tab and then on Add Reference… enter image description here

Then select System.Drawing or whatever you want.

Share:
62,299
4box
Author by

4box

Updated on October 12, 2020

Comments

  • 4box
    4box over 3 years

    I'm trying to create a validation image using class library in asp.net, but that is not the question.

    Anyway, my question is... well... system.drawing does not exist so I cant use "bitmap". From similar questions, people tell to add reference. But I already did that, restarted my computer etc. It doesn't work.

    What can I do besides adding reference? It doesn't work or am I doing it wrong ?

    Here is basically what I did:

    • Right click to references, which is under solution,
    • add reference
    • add system.drawing

    But still, it does not appear in intellisense or tells me "it does not exist, try adding reference" when I type it manually.

    picture

    • alun
      alun almost 13 years
      Please attach the full sourcecode of the file where you are trying to call into a method in System.Drawing.
    • V4Vendetta
      V4Vendetta almost 13 years
      Do you get it by typping System.Drawing.Bitmap
    • Can Poyrazoğlu
      Can Poyrazoğlu almost 13 years
      when you write the class name, does a small rectangle under the name appear telling to add the using directive?
    • 4box
      4box almost 13 years
      Nope, I dont get it.(when I type system.drawing(with correct cases of course) it does not appear. well, Im just trying to add it to top of namespace. but fine with using it in code so... it still does not appear anyway.
    • CodeNaked
      CodeNaked almost 13 years
      Are you adding the correct version? If you are on .NET 4, it should be 4.0.0.0.
    • CodeNaked
      CodeNaked almost 13 years
      Only other thing I can think of is you added the reference to the wrong project. Is the Validator.cs file in the project that has the System.Drawing reference?
  • SoftwareSavant
    SoftwareSavant over 9 years
    That is a terrible answer, didn't you see his screenshot? I am having the exact same problem and I can't figure out what is causing it? I have included the reference and added a using statement at the top of my code. Yet I can't use the Image namespace in that class?
  • driis
    driis over 9 years
    @DmainEvent No, I didn't see the screenshot since it wasn't in the original question. It was added later, after I answered. In retrospect, obviously this answer is irrelevant ;)
  • Kyle Sweet
    Kyle Sweet almost 5 years
    this option doesn't exist in my Visual Studio/C# project
  • Epirocks
    Epirocks almost 4 years
    Brilliant. I had a class library and was adding the reference to the wrong project I thought I was losing it there. Thanks for pointing this out.