How can I get the .NET Core SDK to work on Docker? I get the following exception: Unhandled Exception: System.DllNotFoundException: Unable to load shared library ‘PDFNetC’ or one of its dependencies.
The project needs to know where the shared lib is located. You can achieve this by any one of the following 2 approaches.
You will add the following to the Docker file:
COPY libPDFNet* /usr/lib/
RUN rm /usr/lib/libPDFNetC.so;
mv /usr/lib/libPDFNetC.so.6.10.0 /usr/lib/libPDFNetC.so
Adding the above commands will resolve the following two issues:
- PDFTron’s native library needs to be placed directly in “/usr/lib/” folder
- Docker does not like how we symlink the so files, so removing the symlink is required
Manually remove the symlink
libPDFNetC.soand rename the versioned so to
Edit the .csproj file to directly point to
<Content Include="/src/MyApp/libPDFNetC.so"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content>