WCF Service Reference does not reuse types in existing assemblies (VS 2010 Beta 2)

后端 未结 3 1739
南方客
南方客 2021-02-20 04:09

I\'m looking for the best approach to share types (the actual classes, not proxies) between a WCF service and a client. To that end, I defined the classes in a separate assembl

相关标签:
3条回答
  • 2021-02-20 04:50

    I did two things in the same step. Not sure if one or both resolved the problem:

    1. Added a [DataContract(Namespace="My.Shared.Assemblys.Namespace")] to one of the classes in the shared assembly.
    2. Restarted VS 2010 Beta 2
    0 讨论(0)
  • 2021-02-20 04:57

    My issue with VS2010 SP1 was trying to use a class that derived from Dictionary<T,U> with a CollectionDataContract attribute. Seems VS won't reuse the type... I also tried Eric's suggestion above, but it didn't work.

    0 讨论(0)
  • 2021-02-20 05:00

    Had the same issue, but the I forgot to build assembly with DataContracts for client and thus it was generating it's own contracts. Once I've rebuilt the assembly - it reused them.

    0 讨论(0)
提交回复
热议问题