0

We're using EvoPDF in an NET6 C# MVC application to convert HTML to PDF files for display and emailing as attachments.

Using EvoPdf.HtmlToPdf.NetCore in our development environment works fine. If we publish from Visual Studio using Deployment Mode = Framework-dependent then EvoPdf works ok.

If we publish from Visual Studio using Deployment Mode = Self-contained and run EvoPdf we get an error

Could not create image object. Could not load type 'System.StubHelpers.InterfaceMarshaler' from assembly 'System.Private.Corelib, Version=6.0.0.0, Culture=neutral, ....

As we'd rather have a self-contained install on our Live servers this is a major pain !

Any suggestions gratefully received.

Chris C.
  • 908
  • 1
  • 10
  • 19

1 Answers1

0

I have same issue, you can try uncheck Trim unused code option in publish setting. you can use dnspy load this dll & search InterfaceMarshaler check whether it exists in published dll, maybe it exists in debug folder but not exists in publish folder.

System.Private.CoreLib.dll 10.4MB in dotnet 7.0 shared directory

System.Private.CoreLib.dll take 10.4MB size in dotnet 7.0 shared directory.

You can simply copy dll from shared directory to publish directory.

shine
  • 610
  • 3
  • 10
  • Thanks, but we went with a Framework-dependent publish. Not ideal but it works and the publish package is much smaller. – Chris C. Apr 10 '22 at 07:14