Home > Articles > Details

Could not copy the file to the destination file because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles


Question: How do you solve the error that says "Could not copy the file to the destination file because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles". This error happens when you are publishing an Asp.Net Core 7 Web API to Linux Environment.

Login to See the Rest of the Answer

Answer: There is a chance that the folder you are publishing contains files from the previous version of Asp.Net Core hence some files were published to a folder and not to the specific file location.

In order to resolve this error, make sure that you delete all the files in the publishing folder and try again to publish the Web API.


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

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

Mark said:

Great, thank you.

Posted On: November 19, 2022 10:22:20 AM

© 2022 - ErnesTech - Privacy