Visual Studio Shared Project "call is ambiguous"
June 01, 2016
Shared projects are a relatively new thing in Visual Studio, they allow you to share code across multiple assemblies without compiling it in its own dll (the code is compiled into the referencing projects dll).
Today I came across a bit of a gotcha -
If you reference a shared project in an assembly A and in assembly B, now both of those projects define and export all of the public code from the shared project.
Now you have a 3rd project C that also has a reference to the shared project, but also references A and B. You will get a compiler error "call is ambiguous" since the namespace/class/method you are trying to use is now defined 3 times.
The simple answer, which is counter intuitive to "normal" library development is to make all of your "shared project" classes "internal" instead of "public". That way each assembly that references the shared project can use the code internally but will not export it to other assemblies.