Aphex
Aphex

Reputation: 408

System.Drawing.Bitmap not recognised in Visual Studio 2017

I am writing a project in F# that uses the Bitmap functionality of System.Drawing, NET Standard 2.0, but the project can't be built because The type 'Bitmap' is not defined in 'System.Drawing'.

I have tried to add reference to System.Drawing in various locations and made sure I used the NET Standard library version. Also, I've repaired + reinstalled Visual Studio without any luck as well.

When right-clicking on the project and clicking 'Add Reference', I'm met with the following message. Could this be related to my issue?

Error

EDIT: As a slight plot twist/contradiction, I can execute the code in F# interactive where System.Drawing.Bitmap is perfectly accepted and compiling without any trouble. Where could the error lie?

Upvotes: 2

Views: 2993

Answers (2)

Lanayx
Lanayx

Reputation: 2876

It is available in this Nuget package (although in preview version yet, still works fine) https://www.nuget.org/packages/System.Drawing.Common/

Upvotes: 3

ekim boran
ekim boran

Reputation: 1819

Most of the System.Drawing functionality is not available in .Net Core. (There are too many dependencies to native Windows libraries) You can either switch to .net framework or include third party packages like https://github.com/CoreCompat/System.Drawing

Upvotes: 3

Related Questions