IntroductionI have already written an articles on how to publish web application in IIS using visual studio. Today, I am writing a very known issue Copying file failed in publish using Visual Studio, it comes issue while deleted files remained in visual studio solution. I am in this article demonstrating below how to get rid of this issue.
Error DescriptionError 1 Copying file Themes\X20\Content\bootstrap-switch\js\bootstrap-switch.js to
obj\Release\Package\PackageTmp\Themes\X20\Content\bootstrap-switch\js\bootstrap-switch.js failed. Could not find file 'Themes\X20\Content\bootstrap-switch\js\bootstrap-switch.js'.
I have provided different approaches to resolve issue Copying file failed in publish using Visual Studio.
Approach First (Remove deleted files reference from Solution)I already physically files removed from project folder but not removed files from visual studio studio opened project source files that is why referring already removed files in Visual Studio project. Files excluded from project showing in marked yellow in visual studio solution, once I removed these files from visual studio project it worked fine for me. When I tried to publish Web App project using visual studio, once I click on option Publish in Visual Studio project after then I ran into issue Copying file failed.
Approach Second (Exclude generated debug symbols)Open your project in visual basic after then right click on project and click on Properties, now navigate to Package/Publish Web tab. Now tick option "Exclude generated debug symbols", after ticking this option your solution will publish successfully.
|Figure: Right Click on Project|
|Figure: Exclude generated debug symbols|