I have a solution which has three layers: common, data, and business
The common layer defines objects that are be referenced and used by the other layers. The data layer contains data access code and the business layer contains business logic. Each layer contains multiple projects.
The data and business layers expose WCF services which have objects from the common layer as parameters. Both the data and business layers reference the common layer directly via project references.
The business layer references the data layer via a service reference. The service references are set to 'Reuse types in referenced assemblies' because there are multiple references to the data layer services in a single business layer project and each of the data layer services uses the same objects from the common layer.
I am writing unit tests for the business layer and I am continually getting errors like this: Value of type Common.ClassName cannot be converted to Common.ClassName. Type mismatch could be due to the mixing of a file reference with a project reference to assembly Common. Try replacing the file reference with a project reference.
It isn't a file reference, it is definitely a project reference. Looking here I see this item
To access a type defined in another assembly, the Visual Basic compiler must have a reference to that assembly. This must be a single, unambiguous reference that does not cause circular references among projects.
As far as I can tell I do not have any circular references so what other problems could be causing this error message and/or how can I prevent this wasting so much of my time clicking on update service reference and hoping that this time it will work?
Note that I don't get a choice about this architecture, it is imposed by our software architect.
The environment is Windows 8 with Visual Studio 2012.