I'm trying to resolve problem with referencing shared project within couple class libraries.
Inside solution the references between projects are:
In shared project I have only one class with logic, that I want to share, so in each class library project I'm using same class from shared project. But after build i get folowing error in Class library C:
The type 'same class' exists in both Class library A and Class library B
Is there a way to make this work, or shoul I replace shared project with classic class library?
A 'shared project' is effectively a way of sharing the source code between multiple projects without having to build a DLL (like in a class library). You can think of it as literally copy pasting the source code of SharedProject into Class library A and Class library B.
It should be fairly obvious at this point then that Class library A and Class library B do have the same classes defined in SharedProject, however they both define them, rather than both referencing the same classes.
Your initial intuition is correct, the correct way to do it is to replace it with a class library, which is exactly what it's for. You'll then have a SharedProject.dll that both A and B reference, and then C will reference A.dll, B.dll and SharedProject.dll, and it should all be fine (barring version mismatches).