Stumbling here because you are having trouble updating a service reference in your Windows Phone 7 application? Are you getting a warning that reads something like this?
Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Could not load type 'System.Runtime.Serialization.DataContractSet' from assembly 'System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
Or this?
Custom tool warning: No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.
I’ve had this problem several times now, and each time I’m stumped why this happens. So I am writing down what causes this once and for all so that I don’t keep forgetting. Here it goes …
Frequently I am wanting to consume OData feeds within my apps. An easy way to do so is to use the Open Data Protocol Client Library available on CodePlex. The library contains the System.Data.Services.Client.dll assembly that you reference in your Windows Phone application project.
This assembly is trouble when trying to mix with service reference generation. I’ve seen posts that talk about deselecting the “Reuse Types in Referenced Assemblies” option when generating the reference, but this is not exactly a solution I am happy with. What if I do want to reuse types?
The best workaround I’ve come up with so far is to generate my service references in a separate Windows Phone Class Library project that does not reference the System.Data.Services.Client.dll. I then add a project reference to this class library in the WP7 application project. Finally, I need to copy the system.serviceModel entries generated in the class library’s ServiceReferences.ClientConfig file to the WP7 application’s ServiceReferences.ClientConfig file.
It is also probably not a bad idea to include any OData generated proxies along with the System.Data.Services.Client.dll in a separate Windows Phone Class Library project as well.
I hope this post saves you some headache as it will for me time and time again.
Can you please post an example of the project or send it by email?
Regards
Paulo Aboim Pinto
Odivelas - Portugal
An excellent explantion of the issue. Saved a lot of time and following of red herrings.
I’m having this same problem but I don’t use that dll. How does a dll conflict with a service reference? This problem has proven to be erratic as it works and then sometimes it wont add the service ref correctly. Have you learned any more about it?
thanks, Gay
Hi,
I used your technic, however when I’m creating the Client, I’m getting:
Could not find default endpoint element that references contract ‘FileUploader.IFileUploader’ in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
Any clue?
Thanks
The following solved my problem, I created a new WP7 project added the wcf service copied the Service References folder to the directory of my project that gave me this problem. Then I restarted my Visual studio and built the application. you should get namespace errors inside your Reference.cs just change the namespace and bob’s your uncle.