Home Articles Details

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?

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.


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

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


© 2023 - ErnesTech LLC- Privacy