Xcode build error - Multiple commands produce .o, Target 'ProjectCoreData' has compile command for Swift source files listed twice : <p>I am running xCode Version 10.1 (10B61), Mojave 10.14 (18A391)</p>

<p>Searching shows similar issue in Xcode 10 greater than a year ago, but no issues since then. The solution from last year seemed to be switching to legacy mode, but that doesn't work now. It appears the source code that is stored on my desktop is conflicting with code that is in 'DerivedData', I'm not sure why this would suddenly pop up so randomly.</p>

<p>I see this problem go away if I remove the last model added in Core Data. It seems to trigger when I add a relationship to another object. It's apparently random.</p>

<p>Any advice on how to fix this issue so I can develop? </p>

<pre><code>Multiple commands produce '//Library/Developer/Xcode/DerivedData/ProjectCoreData-ehjvvgovpitmbcegzopwciptfafr/Build/Intermediates.noindex/ProjectCoreData.build/Debug-iphonesimulator/ProjectCoreData.build/Objects-normal/x86_64/Contact+CoreDataClass.o':

Target 'ProjectCoreData' (project 'ProjectCoreData') has compile command for Swift source files

Target 'ProjectCoreData' (project 'ProjectCoreData') has compile command for Swift source files
</code></pre>

<p>from the logs:</p>

<pre><code>&lt;unknown&gt;:0: error: filename "Contact+CoreDataClass.swift" used twice: '/Users/&lt;user&gt;/Desktop/ProjectCoreData/Contact+CoreDataClass.swift' and '/Users/&lt;user&gt;/Library/Developer/Xcode/DerivedData/ProjectCoreData-ehjvvgovpitmbcegzopwciptfafr/Build/Intermediates.noindex/ProjectCoreData.build/Debug-iphonesimulator/ProjectCoreData.build/DerivedSources/CoreDataGenerated/ProjectCoreData/Contact+CoreDataClass.swift'
&lt;unknown&gt;:0: note: filenames are used to distinguish private declarations with the same name
&lt;unknown&gt;:0: error: filename "Contact+CoreDataProperties.swift" used twice: '/Users/&lt;user&gt;/Desktop/ProjectCoreData/Contact+CoreDataProperties.swift' and '/Users/&lt;user&gt;/Library/Developer/Xcode/DerivedData/ProjectCoreData-ehjvvgovpitmbcegzopwciptfafr/Build/Intermediates.noindex/ProjectCoreData.build/Debug-iphonesimulator/ProjectCoreData.build/DerivedSources/CoreDataGenerated/ProjectCoreData/Contact+CoreDataProperties.swift'
&lt;unknown&gt;:0: note: filenames are used to distinguish private declarations with the same name
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
</code></pre>
