0

This question might seem familiar but I worked to those already answered here and across the Internet without finding an answer:

Edit At the moment, the Service Reference is working fine again, but I'm still on the hunt for a long term solution.

Working on a Windows Phone Application which communicates with a WCF Web Service I noticed that sometimes there where partial classes generated in the Reference.cs by the "Add Service Reference" option within VS 2012 even when the original class was within an assembly shared by the Client and the Service via a Project Reference. This seemed to happen randomly every few times the service was published again or the Client compiled. As one can imagine this let to quite a bunch of "Cannot implicitly convert type " errors. Most of the time I just played around with some options, deleting and adding the Service Reference again, restarting VS and so one, hoping for some arcane magic to happen and sooner or later it did. But this is not a way which satisfies me or which I would like to use forever. Especially since the problem appeared again yesterday and until now, no arcane magic took place. So here's what I tried so far:

  1. Removing and adding the Service Reference again with differing options and names(like share all assemblies, share specified assemblies...)
  2. Restart VS some times with and without administrator privileges
  3. Removing the entire class causing the problem from the Shared assembly and adding it again(compiles and publishes in between)
  4. Having a look at namespaces in the WCFTestClient which differed from the one generated by VS
  5. All of the above on different machines

I also carefully worked through this and other similar questions here.

None of this brought me to a point where I would have been able to solve the problem itself though I learned a lot. Right now I am working on generating the proxy class with SVCUtil but as I am quite new to the whole WCF-Stuff this hasn't been successful yet. I would really appreciate if

  1. Someone was able to enlighten me what makes the "Add Service Reference" option to generate those unwanted partial classes after all and how to avoid it.
  2. There was a description provided on how to make proper use of the SVCUtil Tool for generating a proxy class and reusing it in a VS Project
  3. There was a way to avoid this whole "code generation from metadata", I mean, I got access to both implementations

I would really like to solve this problem within VS, but with increasing desperation I get willing to try and do a lot of work if this problem is not to occur again afterwards. Currently I am working on the second possible solution. Considering the third, I am reading this article, but before trying it I'd like to here a second opinion whether it is a good way so solve my problem and maybe have a look at a more recent article covering the topic.

Sorry for the wall of text, I've been working on this for quite a while now and with little knowledge and lots of tryouts come lots of information.

Community
  • 1
  • 1
MoRoBe
  • 119
  • 2
  • 11

1 Answers1

3

Try unchecking "Reuse types in referenced assemblies" to see if that helps.

Try unchecking "Reuse types in referenced assemblies".

Chris Holwerda
  • 1,255
  • 1
  • 10
  • 20
  • 1
    If that box is unchecked, there is a partial class created for every DataContract. But I do not want any of them, since all DataContracts are in a shared assembly. Rechecking the box again reduces the partial classes to two, but even those are unwanted. – MoRoBe Mar 12 '13 at 21:30