Type ambiguity between two referenced assemblies
c#
Solution
You could try the `TypeForwardedTo` Attribute.
[assembly:TypeForwardedTo(typeof(Class1))]
That way you can move the type to another assembly entirely without breaking anything. You don't even need to rebuild referencing assemblies, because the runtime handles the forwarding for you. See here for more information: Type forwarding using TypeForwardedTo attribute
EDIT: If you can't reference Assembly2 from Assembly1, you can define an `extern alias`: MSDN Documentation for extern alias (C# Reference)
You can define them by selecting the reference to the assembly in the Solution explorer and editing the Aliases in the property Window.
You'd then just need to qualify your type with `yourAlias::Class1`.
Problem
I have the the following problem that starts to drive me nuts. I have a class say `Class1` in Assembly1. I moved `Class1` to Assembly2 and obsoleted `Class1` in Assembly2 (Kept the same namespace and I can't remove it now to avoid a breaking change for my users). Now I have a unit test assembly, TestAssembly2 that references both assemblies Assembly1 and Assembly2. Now I get a compilation problem `Class1` ambiguity when trying to use `Class1` in my unit tests. This makes sense as I have two `Class1` in both assemblies Assembly1 and Assembly2. QUESTION Is there a way to tell the compiler to use `Class1` defined in Assembly2 (as the one in Assembly1 is obsolete) not Assembly1? EDIT I can't use type forwarding as Assembly1 must not have a reference to Assembly2 :(