Closed gr3ysky closed 2 years ago
We are currently working on replacing System.Drawing.Common, likely available early next year, but for now you can set the System.Drawing.EnableUnixSupport switch. See https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only .
This not working for me, I waiting for new update. While I have to use a windows container 😞
Hmm that's weired. We are currently working on this in this branch https://github.com/EPPlusSoftware/EPPlus/tree/feature/drawing_to_skia, but it's "Work In Progress". System.Drawing.Common will be removed from .NET standard/core (we will also add a new .NET6 build). We will add native image and text measure support with fallback on Skia or System.Drawing.Common.
This not working for me, I waiting for new update. While I have to use a windows container 😞
Have you tried with libgdiplus? We use it in alpine image. Ex.:: RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ && apk add --update --no-cache \ libgdiplus
Just set this line anywhere before creating an excel file and forget about it
AppContext.SetSwitch("System.Drawing.EnableUnixSupport", true);
Alternatively, you can set switch in csproj
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Drawing.EnableUnixSupport" Value="true" />
</ItemGroup>
or environment variable in the Dockerfile
ENV DOTNET_System_Drawing_EnableUnixSupport=true
Dotnet 7 preview has removed the compatibility flag also.
EPPlus 6 will remove the dependence on System.Drawing.Common. We will release EPPlus 6 as beta this week or the week after. Feel free to help us test if when it's available. If you want to test it now, please build EPPlus from this branch...https://github.com/EPPlusSoftware/EPPlus/tree/beta/epplus6.
See breaking changes here... https://github.com/EPPlusSoftware/EPPlus/wiki/Breaking-Changes-in-EPPlus-6
Many thanks @JanKallman I'll build from source and try
Feel free to try EPPlus 6.0.0-beta, now released on Nuget. Also checkout our new docker sample available here...https://github.com/EPPlusSoftware/EPPlus.DockerSample
Fixed in version 6.0.3
Fixed in version 6.0.3
many thanks.
Sorry for commenting on an older, closed isuse - but I'm tracking down an issue with System.Drawing.Common and .NET 7 and as far as I can say, EPPlus 6 still has an (indirect) dependency on System.Drawing.Common (via EPPlus.System.Drawing)? Is this correct?
Yes, but it is only used under Linux if libgdiplus is installed. Otherwise the internal generic image handler is used. System.Drawing.Common is still used under Windows.
Ah, thank you, I see.
In my scenario I still use System.Drawing.Common for very basic stuff, but an older version 5.x version that's still "compatible" with Linux. But that results in package downgrade issues with EPPlus, as EPPlus requires System.Drawing.Common >= 7.0 on .NET 7. I think I can work around that, I just wanted to make sure that this is expected behaviour.
Yes, System.Drawing.Common 7 is intended for .NET 7, but as it is Windows only, I assume it might cause issues if you have to use it using libgdiplus elsewhere. I assume we could consider downgrade it to System.Drawing.Common 6, but in the end libgdiplus is a dead end and will not be supported in future versions.
Thanks! I did work around the issue by downgrading EPPlus to a 5.x version (I don't need any of the newer features) as this version still uses System.Drawing.Common <= 5.0.x, which allows me to use this version of System.Drawing.Common in my own code (and not getting any package version conflict/fallback issues). Not ideal, but I was not able to think of a better solution?
I use EPPlus for export data as Excel files. Currently, System.Drawwing.Common is not supported for net6 applications runing under linux (as a docker image).
Here is the exception
This was working on net5. Is there a way to fix this? Thanks.