Failed to generate the PowerServer Web APIs project

The following error is reported in the Output window during the build & deploy process:

Failed to delete the file “C:\Users\appeon\source\repos\PowerServer_pssales\ServerAPIs\bin\Debug\netcoreapp3.1\xxxx.dll” 
because it may be occupied by another program. Error code: 5.
Failed to generate the PowerServer Web APIs project. Error code: 0.

Or

Failed to delete the folder “C:\Users\appeon\source\repos\PowerServer_pssales\ServerAPIs” 
because it may be occupied by another program. Error code: 32.
Failed to generate the PowerServer Web APIs project. Error code: 0.

Solution:

1. Close the PowerServer C# solution (PowerServer_pssales in the above example) if it is currently opened in any C# editor.

2. Close the Web APIs if it is currently running.

3. Build and deploy the project again.