Reputation: 353
We have two solutions (C#, VS2015) that consist of a few projects. The Basic-Solution with namespace Wpf has some classes that are re-written in the More Advanced - Solution in the namespace Wpf.Advanced because the more advanced solution uses different data types for example.
Since every code-change in one of the classes, that are present in both solutions, needs to be rewritten in the second file, we decided to change the structure and use a shared project as a single place where the files should be located for both solutions.
We now use "usings" in combination with precompiler #if #else #endif blocks to merge the two files into one by changing the data types based on the project (via a compilation symbol ADVANCED).
Now to the problem:
Since some of our example projects need to reference both, the Wpf and the shared project we get the mentioned warnings CS0436 because some objects, that now exist in the shared project and in the namespace Wpf.
How can I resolve this issue? I mean, everything works, but no warning is better than any warning, thank you!
Upvotes: 3
Views: 1555
Reputation: 2208
I just had similar situation. In exe project I referenced dll and shared project. The dll in turn was referencing shared project. The solution was to exclude the shared project from the exe project. Since the shared project gets referenced from the dll the exe gets all of them too.
It may look trivial unless you are not experienced with shared projects.
Upvotes: 1
Reputation: 177
The namespace NamespaceName1
in NamespaceName2
conflicts with the type TypeName1
in NamespaceName3
This error occurs when the imported type and the imported namespace have the same fully qualified name. When that duplicate name is referenced, the compiler is unable to distinguish between the two.
Upvotes: 0