This is a known bug per microsoft and one of the work arounds fixed it to me:
It looks like Visual Studio insists building projects that started
their life as a WCFService Application. After removing the WCF Service
Application specific tags from the csproj xml files, unit tests work
every time. I removed the following tags: Under Property Group: Remove
ProjectTypeGuids and StartArguments Remove entire ProjectExtensions
node
FYI, to edit a project file first right click and unload the project. Then right click again and edit project file. The removed attributes shouldn't affect the running of the WCF service
source