Beakie
Beakie

Reputation: 2009

.NET Standard 2.0 library referenced by .NET 4.6.1 project - Wrong version of Drawing library referenced

I am trying to get a .NET standard 2.0 library (that uses System.Drawing) to be referenced by a .NET 4.6.1 project (that implements a function that passes the ImageFormat enum).

I get the following error in the implementing project.

The type 'ImageFormat' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

The .NET standard 2.0 library includes the nuget package System.Drawing.Common 4.5.0 (which includes ImageFormat).

The .NET 4.6.1 project references System.Drawing 4.0.0 (which also includes ImageFormat).

4.5.0 vs 4.0.0

So the message makes sense... I am not referencing the correct version of System.Drawing in the .NET project!

But I can't work out what I need to do to resolve it.

Can anyone please help?

Upvotes: 1

Views: 580

Answers (1)

NickolayNanov00
NickolayNanov00

Reputation: 26

I had a similar problem. I couldnt use anything from .netCore and i had a similar error message and what i did was to right click to the solution and to open the nuget manager and to install the .netCore manualy and it worked. Try it and see if it works. Greetings!

Upvotes: 1

Related Questions