ASP .NET: NuGet package does not copy the PDFNet folder to the bin directory when Publishing

Question:
ASP .NET Web Project: NuGet package does not copy the PDFNet folder to the bin directory when Publishing. Please help.

Answer:

​To get the files copied to the Publish Target Location, please make the following changes:

  1. In your References, please set “Copy Local” property of PDFNet.dll to “True”
  2. Add the following to PublishProfile i.e. *.pubxml
<_CustomFiles Include="bin\**\*" /> bin\%(RecursiveDir)%(Filename)%(Extension)

Under PropertyGroup:

PDFNetFiles; $(CopyAllFilesToSingleFolderForPackageDependsOn); PDFNetFiles; $(CopyAllFilesToSingleFolderForMsdeployDependsOn);

ASP .NET Deploying extra files:

https://docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-extra-files