I'm referencing a WCF service from my client, and the data contracts are located in an assembly within the same solution.
When I add the service reference, it correctly re-uses the project assembly, but it also adds an extra reference to the same assembly, except this one's path points to the client projects bin\Debug output folder.
The problem is that it breaks the build for other developers when the code is pushed to git unless this invalid reference is removed.
I have already added the project reference and instructed svcutil to re-use that reference, why does it add its own afterwards? This happens every time I update the reference too.
Is there something wrong or is this just how it works? I've tried both "Reuse types in all referenced assemblies" and "Reuse types in specified reference assemblies".
After hours of trying to figure out what is going on, I finally managed to get everything right.
I think the reason this was happening was because the assembly I was referencing and wanting to re-use, had the wrong "Assembly Name" property.
I didn't think this would actually cause problems, but I noticed that when adding the project reference, it would show up as "XYZ", but when selecting it from the list of assemblies to re-use in the service reference dialogue, it would show up as "My.Namespace.XYZ", so it had a different name.
I opened the properties dialogue of the assembly, and the value of "Assembly name" was "My.Namespace.XYZ" rather than just "XYZ", so I changed that, and left the "Default Namespace" as it was (My.Namespace.XYZ).
Then I cleaned the solution, removed all the extra leftover files and folders from the client project (bin, obj, Service References, Data Sources, etc..) and added the Service Reference, and this time no extra references were added and everything went to the right places.
UPDATE:
I learned recently, thanks to my colleague, that adding/updating a service reference with build configuration x64 doesn't work with the reuse assemblies feature. I had to switch to AnyCPU, update my service reference, then switch back to x64. Hope this helps anyone wandering here from Google...