Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.drawing namespace not found under console application

I selected console application as my C# project. But the imports that seemed to work under Windows Form project don't seem to work here. It says that the drawing namespace does not exist.

using System.Drawing;
using System.Drawing.Imaging;

My problem is that I need to have the bitmap class. I am trying to make a command line app that does bitmap manipulations to a image. That's why I didn't choose my project to be a Windows Form one.

like image 916
klijo Avatar asked Dec 18 '11 16:12

klijo


3 Answers

You need to add a reference to System.Drawing.dll.

As mentioned in the comments below this can be done as follows: In your Solution Explorer (Where all the files are shown with your project), right click the "References" folder and find System.Drawing on the .NET Tab.

enter image description here

enter image description here

like image 137
SLaks Avatar answered Sep 24 '22 20:09

SLaks


If you are using Visual Studio 2010 or plus then check the target framework that is it .Net Framework 4.0 or .Net Framework 4.0 Client Profile. then change is to .Net Framework 4.0.

You need to add reference this .dll file (System.Drawing.dll) to perform drawing operations.

If it is OK then follow these steps to add reference to System.Drawing.dll

  1. In Solution Explorer, right-click on the project node and click Add Reference.
  2. In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
  3. Select the System.Drawing.dll to reference, then click OK.
like image 10
Niranjan Singh Avatar answered Sep 20 '22 20:09

Niranjan Singh


  1. Add using System.Drawing;
  2. Go to solution explorer and right click on references and select add reference
  3. Click on assemblies on the left
  4. search for system.drawing
  5. check system.drawing
  6. Click OK
  7. Done
like image 10
WhiteWolfza Avatar answered Sep 21 '22 20:09

WhiteWolfza