Closed andbjer closed 3 years ago
Please see if the fix I just pushed solved the issue.
What's the easiest way for me to test this?
I've pulled down the code from the repository and added the project to my solution. I added every runtime manually in the same folder structure as it is listed in DinkToPdf.csproj
:
<None Include="runtimes\linux-x64\native\libwkhtmltox.so" Pack="true" PackagePath="runtimes\linux-x64\native" />
<None Include="runtimes\linux-x86\native\libwkhtmltox.so" Pack="true" PackagePath="runtimes\linux-x86\native" />
<None Include="runtimes\osx-x64\native\libwkhtmltox.dylib" Pack="true" PackagePath="runtimes\osx-x64\native" />
<None Include="runtimes\win-x64\native\wkhtmltox.dll" Pack="true" PackagePath="runtimes\win-x64\native" />
<None Include="runtimes\win-x86\native\wkhtmltox.dll" Pack="true" PackagePath="runtimes\win-x86\native" />
Now I am getting this error when i try to generate a PDF:
System.DllNotFoundException: Unable to load shared library 'wkhtmltox' or one of its dependencies
You probably shouldn't even be loading this in EFCore migration.
Change your DI definition to be lazy:
services.AddSingleton<IConverter>(x => new SynchronizedConverter(new PdfTools()))
I uploaded a pre-release to NuGet, try that. https://www.nuget.org/packages/Haukcode.DinkToPdf/1.1.3-test-dispose-fix
Tested the pre-release and migrations is working again. Thank you!
I also tested the suggestion by @adamhathcock before upgrading to the pre-release. This also solved my problem.
Thank you both!
We currently use this package to generate PDFs from HTML in a .NET Core Web API and it has been working great.
When I try to add a new EF Core migration an unhandled exception is thrown in this package:
In
Startup.cs
I have added theIConverter
as a singleton:Migrations does not work in either Windows or Mac.
Related: #14