Error MSB3021: Unable to copy file

Question: When publishing an application using Visual Studio 2022 the error is thrown "Error MSB3021: Unable to copy file" what is going on?


Please Login to see the rest of the answer

Answer: This error means that you have a file or a folder in your Project Solution with content that does not have a Property "COPY ALL" of "COPY IF NEWER" setting. 

If you wish not publish certain content in some folder for whatever reason, then right-click on your projects.csproj file, edit it to include 

  <None Remove="wwwroot\" /> this will leave the folder wwwroot when publishing to production.


Write an Article
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.


© 2022 - ErnesTech - Privacy