System.drawing namespace not found under console application

C#NamespacesBitmapConsole Application

C# Problem Overview


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.

C# Solutions


Solution 1 - C#

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

Solution 2 - C#

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.

Select the System.Drawing.dll to reference, then click OK.

Solution 3 - C#

  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

Solution 4 - C#

For,Adding System.Drawing Follow some steps: Firstly, right click on the solution and click on add Reference. Secondly, Select the .NET Folder. And then double click on the Using.System.Drawing;

Solution 5 - C#

Install-Package System.Drawing.Common

Solution 6 - C#

Add reference .dll file to project. Right, Click on Project reference folder --> click on Add Reference -->.Net tab you will find System.Drawing --> click on ok this will add a reference to System.Drawing

Solution 7 - C#

Install this library from Nuget

System.Drawing.Common

https://www.nuget.org/packages/System.Drawing.Common/6.0.0

Solution 8 - C#

  1. Right click on properties of Console Application.
  2. Check Target framework
  3. If it is .Net framework 4.0 Client Profile then change it to .Net Framework 4.0

It works now

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionklijoView Question on Stackoverflow
Solution 1 - C#SLaksView Answer on Stackoverflow
Solution 2 - C#Niranjan SinghView Answer on Stackoverflow
Solution 3 - C#WhiteWolfzaView Answer on Stackoverflow
Solution 4 - C#user2635504View Answer on Stackoverflow
Solution 5 - C#Rukshala WeerasingheView Answer on Stackoverflow
Solution 6 - C#Niraj TrivediView Answer on Stackoverflow
Solution 7 - C#Dushyanth KandiahView Answer on Stackoverflow
Solution 8 - C#dotnetstepView Answer on Stackoverflow