Search code examples
c#wcfvisual-studio-2012visual-studio-2013datacontract

WCF Update Service Reference no longer generating types for data contracts


I have a WCF service that used to work fine. Anytime that I added new service contracts or data contracts, I could simply right click on the service reference in my client project and choose Update Service Reference, and it would update fine.

Before today, the last time that I had updated the service reference was 5 months ago, and at that time it updated fine. Today, I added a couple new service contracts to the service project and updated the service reference in the client project. What happened is that the service was generated fine, but the types (from the data contracts) did not. My new service reference has no types in it at all. All I have is the service itself and the functions to call the service contracts.

Here is what my service reference looked like when it was working correctly: Here is what my service reference looked like when it was working correctly:

Here is what it looks like now:

Here is what it looks like now:

Thinking that I must have accidentally broken something in the service in the last 5 months, I went back to my source control and checked out the old version of the service project on the day that I last successfully updated the service reference in my client. I rebuilt the service project and then updated my service reference, but it did not fix it. I still have no types.

If I go back and check out the old version of the service reference itself in the client project, then I get the types back. However, this does not help me because I need to add new service contracts and have it generate a new updated working service contract.

I searched for others having the same problem, and I found a post from someone saying that they fixed it by unchecking "Reuse types in referenced assemblies" in the service configuration. I tried that, but not only did it not bring back my types, but it also removed the service itself.

What could be causing it?

Keep in mind that I've already gone back to the old version of the service project from when it was working, and that didn't fix it, so it shouldn't have anything to do with what I have in my service contract or data contract definitions. It must lie somewhere else in my solution or in Visual Studio configuration.

There is only one major thing that happened recently that could possibly shed some light on it. I recently started working with another developer, and we are sharing the solution via source control. I am using Visual Studio 2012 Pro, and he is using Visual Studio 2013 Ultimate. Could his version of Visual Studio have done something to the solution that is causing this problem in my version? If so, what?

Update:

I created a new Windows Forms project in a solution and copied the service project to it as well. I added a service reference in the main project to the service, and it worked correctly. This is on the same development machine as before. So, I guess the questions is: What could be wrong with my original project, and how can I fix it?


Solution

  • Ok, I was finally able to solve it. All I had to do was clean the solution. Right-click on the topmost solution node in the Solution Explorer, and choose "Clean Solution". After that, I did a "Rebuild All" on the service project. Finally, I did an "Update Service Reference" on the service reference in my client application, and it then updated correctly with all my types. Still not sure what happened, but at least this cleared out whatever gremlins were messing things up.