'Error MSB3027: Could not copy "/src/app/obj/Debug/net6.0/apphost" to "bin/Debug/net6.0/lucky-music". Exceeded retry count of 10. Failed

I'm running a .net's unit test (with xunit) in my docker container. Unfortunately, it results with this error:

Error MSB3027: Could not copy "/src/app/obj/Debug/net6.0/apphost" to "bin/Debug/net6.0/lucky-music". Exceeded retry count of 10. Failed.


Solution 1:[1]

Fix that worked for me was to remove obj, bin and out directories at locations where my *.csproj resides prior to running my unit test.

rm -rf /src/app/obj/ \
    /src/app/out/ \
    /src/app/bin/ \
    /src/tests/obj/ \
    /src/tests/out/ \
    /src/tests/bin/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lukasz Dynowski