I have made a class library for PDF-generation. It is implemented using PDFshart-MigraDoc (the core package*). The class library itself is made with .NET Standard as its target framework.
I can use the class library in classic C# projects (like WinForms), but if I try to use it with .NET Core 2.0, I get the following error:
Could not load file or assembly 'System.Drawing.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=xxxx'. The system cannot find the file specified.
I guess the reason for this, could be that MigraDoc is using 'System.Drawing' in its implementation, which is (as far as I know) not supported by the .NET Core framework.
However, that doesn't really solve my problem, which is that I need the class library to work for all .NET frameworks. I have tried to include the NuGet package CoreCompat.System.Drawing, based on advise from this post. But this has been without effect, probably because MigraDoc is still trying to use the "original" System.Drawing
library.
Is there any way, in which I can get my class library to work for .NET Core? Or am I out of luck...?
Note: The MigraDoc Core Package has nothing to do with the .NET Core Framework. The clash of names is merely a coincidence.
I found a port for PDFSharp & MigraDoc here on github which usesSystem.Drawing.Common
and works with .Net Core.
I had the same and got it fully working.
Note: You may need to add System.Drawing.Common
Nuget Package in your .Net Core project.