Closed ddizh closed 4 years ago
I have no idea, I never tested this on Azure.
I found this article on stack overflow --> https://stackoverflow.com/questions/51904125/azure-function-gives-error-system-drawing-is-not-supported-on-this-platform
A little update can help a lot of people. Now you can switch your Azure Function to v3: in Function app settings panel -> Runtime version ~3
With this setup, your code run in a sandbox that support Core 3, (you don't need to rebuild your dll to Core3, i run my .net core 2.1 dll without errors), and surprise... you don't get this exception anymore:
System.Drawing.Common: System.Drawing is not supported on this platform.
Because the CLI can found GDI/GDI+ that need in the subsystem. Now i can convert html to pdf without go crazy.
For anyone having this same issue, this is how we solved it:
the issue was that we didn't properly clear the publish folder. The old version of the library was stuck in that folder. So dotnet clean --output ...
doesn't work in that case for whatever reason and we now remove publish output folder every time.
This has nothing to do with Azure or runtimes.
We are hosting our .netcoreapp 2.1 application on Azure App Service with x64 bit mode enabled. The way we publish our app is
The
MsgReader
is referenced in one of our .netstandard2.0 projects like that:This is what we get:
Note that it does work fine without the --runtime flag being set during publish. Any advises on how to fix this issue?