i have a Shared Project (SharedProject1) with a Class Called myDataInfo.cs and 2 Libraries (Common.csproj and CustomControls.csproj)
, this two libraries uses SharedProject1. now i am using this 2 libraries in a Project Called Test.csproj. now when i want to use myDataInfo.cs i get an error that say
myDataInfo.cs is exist in both Common.csproj and CustomControls.csproj
Shared projects share the source code, not the compiled code. This means that if two projects share the same code they will compile it twice. This results in having two distinct types
myDataInfoinCommonand amyDataInfoinCustomControls. They happen to have the same name but they are two distinct types. This is because types are identified by their fully qualified type names which consists of an assembly name specification, a namespace specification, and a type name.Therefore you must share the assemblies (DLLs, EXEs, Packages or Project References), not the source code (Shared Projects).
In
Testthe reference toSharedProject1is only required ifTestaccessesmyDataInfodirectly.See also: