'Publishing project is failing due to not finding file on a folder location in Visual Studio

Hi I have a project where I was using the 3rd party tool. This 3rd party tool is in the usual packages folder. The debug build and release build all are successful. but when publishing it is throwing error.

Copying file AssemblyLib\  to obj\Release\Package\PackageTmp\AssemblyLib\ failed. Could not 
find a part of the path 'AssemblyLib\itextsharp.dll'.   WestEndService      0   

Looking at the package.config file it shows the location for the third party tool itext. But I wonder why it is looking at the dll at some other location AssemblyLib and throwing error. If AssbmlyLib is the location where publish would look for the files then why it isn't copied there during release/debug build?

I have done many tricks like clean, rebuild, build, opening and restarting the solution, and some other workaround mentioned in the other posts help

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source