Monday, October 7, 2019

The file is locked by NET Core Host error

Error MSB3027 Could not copy "obj\Debug\netcoreapp3.0\Project.Tests.dll" to "bin\Debug\netcoreapp3.0\Project.Tests.dll". Exceeded retry count of 10. Failed. The file is locked by: ".NET Core Host (35124)" Project.Tests C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 4206

Open task manager, find the Visual Studio process, like in the image below.
Locate the sub process .NET Core Host and terminate it.
This solved the building problem with me.

It could appear separately as well