Added a service reference as usual.
Got a single error message that referenced “other errors and warnings”. No other errors and warnings :
No code was generated in my service reference.
Unchecked “Reuse types in referenced assemblies” check box.
Service reference code gets generated!
But why did this happen? I have another project referencing the same service with the “Reuse types in referenced assemblies” check box checked with no problem. Just out of the blue this project stops working?
First of all, it’s not correct that you didn’t get any other warnngs. It’s clearly visible in your screenshot that you got 7 warnings, but you have deliberately chosen not to show these. Just click on the tab and they will appear.
That aside, I’m encountering the same problem, or symptom at least. Without seeing your actual warning, it’s hard to say.
In “Project1”, I have a service reference to “Service1”.
In “Project2”, I have the same service reference to “Service1”.
In “Project2”, there’s a project reference to “Project1”.
Before upgrading to Silverlight 4, I was able to perform “Update Service Reference” for both of these individually.
Now, though, I can still update the service refs in the “innermost” “Project1”.
Whereas in “Project2”, I get an empty “Reference.cs” file and the same error you got.
I also get a whole bunch of warnings, where the most important one is this (slightly anonymized):
Warning 2 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: The list of referenced types contains more than one type with data contract name ‘ResponseBase’ in namespace ‘http://schemas.datacontract.org/2004/07/XXX’. Verify the list of referenced assemblies for type reuse in the ‘Advanced’ dialog in ‘Add Service Reference’. You need to exclude all but one of the following types. Only matching types can be valid references:
“XXXProxy.ResponseBase, XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”
“XXXProxy.ResponseBase, XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”
XPath to Error Source: //wsdl:definitions[@targetNamespace=”]/wsdl:portType[@name=’XXX’] C:XXXService ReferencesXXXProxyReference.svcmap 1 1 XXX
What this basically is saying, is that when I update the service ref in the “outermost” “Project2”, it tries to create a class (“ResponseBase” in this case), which it thinks it has got already (in the same namespace).
The solution to this is to go into “Configure Service Reference…”, keep the checkbox in “Reuse types in referenced assemblies”, but switch from “Reuse types in all referenced assemblies” to “Reuse types in specified referenced assemblies:”, and then select all of the ones in the list, EXCEPT the project reference to “Project1” in this case.
Don’t know if this makes any sense, but it seems to be to be a breaking change between Silverlight 3 and 4.
What’s even more strange about this is that within “Project1”, there are two service refs against services which in this case both exposes the same base class “ResponseBase”. Why doesn’t it complain about these two proxy classes in the same manner?
LikeLike
If you have “Productitvity Power Tools” installed on VS2010 consider unistall them. My bug finish when remove them.
Julio Trujillo Leon
LikeLike
Thanks a LOT!!! Worked like a charm for me. NNo w if I could only figure out how to reduce the load on my WCF service ….
LikeLike
Thanku
LikeLike
Thanks a lot. It helped solved the problem… hoo…relieved 🙂
LikeLike
Thank you so much! I was just about to bang my head on the table when I saw your article!
Thank you, thank you, thank you!!!!
LikeLike
You save my live. Thanks a lot
LikeLike
Thanks alot dear Morten Grøtan,
LikeLike
thanks
LikeLike