(Please feel free to suggest a more accurate title to this question.)
In my Visual Studio 2015 solution, I have three projects (let's call them Alpha, Beta, and Gamma) that are more or less the same thing, but differ in that they define different backends. Both of these projects hot-plug a class into the same namespace:
Alpha:
namespace SharedNamespace {
public class SharedClass {
// implement SharedClass using Alpha's backend
}
}
Beta:
namespace SharedNamespace {
public class SharedClass {
// implement SharedClass using Beta's backend
}
}
Gamma:
namespace SharedNamespace {
public class SharedClass {
// implement SharedClass using Gamma's backend
}
}
Several projects use this hot-plugged class, each referencing either Alpha, Beta, or Gamma. One of them (let's call it Omricon) used to reference Alpha, but now references Gamma:
// ...
SharedNamespace.SharedClass sharedClass;
sharedClass.DoThing();
// ...
When I attempt to build Omricon, however, the C# compiler gives error CS0433:
The type 'SharedClass' exists in both 'Alpha, Version=0.0.0.0 (etc)'
and 'Gamma, Version=0.0.0.0 (etc)'
However, Omricon only references Gamma when it is built - when I go into the project references list, only the reference to Gamma appears. As far as I understand it, Omricon should know nothing about Alpha at all, much less that it defines a class in the same location. Only Omricon fails to build - other projects that use Alpha and Beta work fine, and when I switch Omricon back to using Alpha, it works fine as well!
It appears to me that a reference to Alpha is being maintained, then, somewhere else. How can I find the stray reference to Alpha, wherever it lies in my code, and remove it?
Note that I have tried forcing a full rebuild (as this answer suggested), and the same error still appears, so it has nothing to do with bad object caching.
EDIT: clarified second to last paragraph