Here are the most likely causes and solutions you can try out:
1. Missing reference to System.Drawing.Common-
In newer .Net versions (especially .Net core, .Net 5,6,or later) the system.drawing namespaces does not come included by default.Manually Install of package is required.
Fix:
Open your terminal or package manager console and run:
Dotnet add package System.Drawing.Common
Or in Visual Studio:
· Right click on your project-> Manage NuGet Packages
· Search for System.Drawing.Common
· Click Install
· Then rebuild your project
2. Ensure project Targets Windows-
As of .Net6 and above System.Drawing.Common is only supported on windows by default
Add this to your .csproj file if you are using .Net 6 or later:
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</Propertygroup>