Helped to fix this compile error a couple weeks ago, Error CS0012 “The type ‘ABC’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘AssemblyX'”.
We confirmed the type ‘ABC’ was clearly defined in assembly ‘AssemblyX’. We then removed and added ‘AssemblyX’ back a few times. The compile error was still there no matter how we tried. [1, 2, 3]
Finally, we had to edit this project .csproj file directly using notepad and removed the reference. Then compiled to get the compilation error, and added the reference back in. This solved our not reference issue.