I want to use system.drawing in my project but I cant make it work.
I have found this question, but it shows only how to add SQLite.NET-PCL, if I try doing it the same way for System.Drawing it doesnt work.
Here is my project.json:
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {
},
"frameworks": {
"net461": {
"dependencies": {
"OpenTK": "2.0.0*"
}
}
},
"runtimes": {
"win7-x64": {},
"win10-x64": {}
}
}
If I try adding System.Drawing it tries to autocomplete to "System.Drawing" : "1.0.0-beta004" which doesnt work with opentk. I am trying to save a image from OpenTK. Is there a way to make this work in VS code?
This problem cost me a good hour of my time trying to solve. Here's the solution that worked for me:
dotnet add package System.Drawing.Common
It appears that System.Drawing is not compatible with .NET Core but Microsoft has released the cross-platform System.Drawing.Common package to compensate that.
Full article/credits/source to here: https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With