Azure Function gives error: System.Drawing is not supported on this platform

前端 未结 2 1740
梦谈多话
梦谈多话 2020-12-01 23:31

(If this question is poorly worded, could someone please help me clear it up?)

I have an Azure Function (2.0) which relies on some System.Drawing code. I\'ve added

2条回答
  •  -上瘾入骨i
    2020-12-02 00:10

    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.

提交回复
热议问题