Error After Publisihing ASP.NET Core using Visual Studio

Let’s continue about error when publishing Asp.net Core. In this article, we will write known issue copying file failed in publish using Visual Studio, it comes issue while deleted files remained in visual studio solution. I’m in this article demonstrating below how to get rid of this issue.

Error Description

Error 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.

How to Fix Error Above

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.

 

Approach Third (Publish Web App in Release Mode)

Sometimes, we don’t care that we are publishing project in debug mode rather than release mode, it also results into issues. While publishing your build, you need to set your project in release mode rather than debug mode. This is also much worrying part while publishing your build. Moreover, publish project in release mode project is in small sized instead of debug mode.

Conclusion

I have demonstrated here three approaches to resolve issue Copying file failed in publish using Visual Studio, I think these approaches are sufficient to resolve this issue, if anyone still gets the same issue then please write me here. Publishing of the project (deployment) is very essential of the project. We should also well equipped to deploy our web app across the internet.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *