Why won't VS2010 RC use my existing types when I add a service reference?
- by Johan Driessen
I have a huge problem getting services references in VS2010 RC to use existing assemblies.
Even though I have a class library with all the data contracts (classes marked with DataContract and properties with DataMember) that is shared between the service project and the consuming project (which is a class library), when I add a service reference, the data contracts are regenerated withing the service reference instead of using the existing types.
When I was using VS2010 beta 2, this worked fine, and I have existing service references using the very same data contracts. But if I add a new service reference, or even update an old one, it won't use the existing types anymore.
I have made a mini-test-solution, with one service, one data contract type and one console app as a consumer (all in the same solution), and there it seems to work, but that's no great comfort to me. Is there any way to see why it can't use the existing types?
Edit to clearify.
It works to generate the proxy classes with svcutil.exe, and point to the data contracts dll, like this:
svcutil.exe http://localhost/MyService.svc
/reference:[Path To DataContracts]\DataContracts.dll
/n:*,MyProject.MyServiceReference /ct:System.Collections.Generic.List`1
The question is, what possible reason could there be for Visual Studio to generate its own datacontracts instead of using the existing ones even though the "reuse" checkbox is checked and the datacontracts assembly is referenced.