System.Drawing does not exist?
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.
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…
Then select System.Drawing
or whatever you want.
4box
Updated on October 12, 2020Comments
-
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.
-
alun almost 13 yearsPlease attach the full sourcecode of the file where you are trying to call into a method in System.Drawing.
-
V4Vendetta almost 13 yearsDo you get it by typping
System.Drawing.Bitmap
-
Can Poyrazoğlu almost 13 yearswhen you write the class name, does a small rectangle under the name appear telling to add the using directive?
-
4box almost 13 yearsNope, 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 almost 13 yearsAre you adding the correct version? If you are on .NET 4, it should be 4.0.0.0.
-
CodeNaked almost 13 yearsOnly 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 over 9 yearsThat 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 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 almost 5 yearsthis option doesn't exist in my Visual Studio/C# project
-
Epirocks almost 4 yearsBrilliant. 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.