2

I am using DinkToPdf to generate pdf document in .net core , it is obligatory to add these files to the project , when I run dotnet build . -c Release -o /app/build in jenkins i get this Error error MSB3027: Could not copy "/src/libwkhtmltox.dll" to "/app/build/libwkhtmltox.dll" I tried to fix the error using <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> in csproj file but still doesn't work

  • Does this answer your question? [Error MSB3027: Could not copy "C:\pagefile.sys" to "bin\roslyn\pagefile.sys". Exceeded retry count of 10. Failed](https://stackoverflow.com/questions/37428409/error-msb3027-could-not-copy-c-pagefile-sys-to-bin-roslyn-pagefile-sys-ex) – Carol-Theodor Pelu Jul 30 '21 at 13:25

1 Answers1

0

It's not obligatory to add all unless you want to support all platforms.

  • so is for Linux
  • dll is for Windows
  • dylib is for Mac

Next for copying, we have to Load these Unmanaged Libraries to assembly Next copy these to output path, in project settings, add

    <ItemGroup>
  <None Update="wkhtmltox\v0.12.4\32 bit\libwkhtmltox.dll">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
  </None>
  <None Update="wkhtmltox\v0.12.4\32 bit\libwkhtmltox.dylib">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
  </None>
  <None Update="wkhtmltox\v0.12.4\32 bit\libwkhtmltox.so">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </None>
  <None Update="wkhtmltox\v0.12.4\64 bit\libwkhtmltox.dll">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
  </None>
  <None Update="wkhtmltox\v0.12.4\64 bit\libwkhtmltox.dylib">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
  <None Update="wkhtmltox\v0.12.4\64 bit\libwkhtmltox.so">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
  <None Update="wwwroot\**\*">
     <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
</ItemGroup>