7

Started using Visual Studio 2012 RC since yesterday, We have one WCF solution. Whenever i try to use the "add/remove reference" dialog in another solution, I get below error after adding the service.

Error 1 Reference.svcmap: Failed to generate code for the service reference 'DPService'. Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Type 'WebSupergoo.ABCpdf8.Objects.Bookmark' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'WebSupergoo.ABCpdf8.Objects.Bookmark' to remove references to itself. XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IGQDynamicPackaging'] Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IGQDynamicPackaging'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='WSHttpContextBinding_IGQDynamicPackaging'] Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='WSHttpContextBinding_IGQDynamicPackaging'] XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='GQService']/wsdl:port[@name='WSHttpContextBinding_IGQDynamicPackaging'] App_WebReferences/DPService/

Please note that : The said service was working properly when i used VS 2010. For your reference, We are using "Reuse types in referenced assemblies " turned on and "reuse types in all referenced assemblies" option checked.

The same settings was working ok with VS 2010 and we can add reference . But now, After installing VS 2012 RC , I can't able to add the reference for both of the VS 2010 and VS2012. Any soluton or work around for this.

I just want to rollback and want to use VS2010, "add service " gives the same reference error in VS 2010 now.

5
  • 1
    I am uninstalling vs 2012 and will uninstall .net 4.5, did you try to do this? was it useful?
    – Saw
    Jun 20, 2012 at 12:32
  • Hi MSS, We didnot try to uninstall that yet. Do you get any success after uninstall ? Appreciate your input on this.
    – amaz
    Jun 20, 2012 at 14:58
  • Uninstalled, but vs 2010 corrupted, re installed vs 2010 (repaired) and trying to see what happened!!!
    – Saw
    Jun 21, 2012 at 8:21
  • 1
    Yeeaaaaaaaaaaah, it is ok now!
    – Saw
    Jun 21, 2012 at 8:25
  • I just had this problem and found that I hadn't added the Visual Studio update 2. After installing the update and restarting my pc it seems ok now
    – DevDave
    May 3, 2013 at 16:41

3 Answers 3

43

I had a similar problem and I unchecked the "Reuse Types in referenced assemblies" checkbox in the Configure Service reference dialog.

1) Right click on Service Reference 2) Select Configure Service Reference 3) Uncheck "Reuse types in referenced assemblies"

I'm not sure of all of the ramifications of doing this but it got me through to be able to use the reference again.

6
  • 2
    In our case, we need to use the "referenced assembly" option since we have separate asssembly which share the types between wcf and web. Notable Point is that we have done lot of coding using the reference assembly. changing all of them back to refer to generated proxy is really nightmare
    – amaz
    Jun 20, 2012 at 23:45
  • 2
    The ramification are that you do not reuse types and it generates a new set of classes for each of your model objects. Fine if they are pocos but sucks if you have say validation shared across client and server. The odd thing is that one user was installing sp1 and things went funny. That somehow effected my machine ... unticking reuse, updating and then turning it back on and everything behaved again. Jun 27, 2012 at 15:26
  • This "worked" for me too, but I shouldn't have to make this change in VS 2010 just because VS 2012 is broken. Is there a way to actually fix this?
    – Mark B
    Aug 20, 2012 at 19:58
  • in VS2012 don't uncheck the entire "Reuse Types in referenced assemblies" but rather just uncheck anything that is not core-microsoft.
    – Nir Levy
    Aug 23, 2012 at 7:42
  • 2
    The problem with doing this is then all the Service method parameters have the Namespace of the Service - not say a shared namespace. So if your passing an object in it likely doesn't match the parameters namespace. Also generates tons of "Ambiguous" reference errors.
    – CmdrTallen
    Sep 10, 2012 at 21:53
4

It looks like the 'CustomerServiceReference' has been defined in two assemblies referenced by your project. The code generator has no idea about which one should be used.

To get rid of this problem, just like Lars said. You can configure your service reference, in its advance options tab, you can disable "reuse types in all referenced assemblies", (by select "reuse types in specified referenced assemblies"). You can select all assemblies except the assembly causing this problem (which defines the CustomerServiceReference as the error message said.)

1

Uninstall vs 2012, vs 2010 will give you "Unknown error", a small error message, repair vs 2010 (re-install it), and it will be OK!

5
  • i do not understand why uninstall vs 2012 then install vs 2010 then re install 2012 Feb 5, 2013 at 15:07
  • i have the same problem by the way Feb 5, 2013 at 15:07
  • I mean: re-install vs 2010 and not vs 2012, the problem caused vs 2010 not to work! so, i repaired it after uninstalling vs 2012.
    – Saw
    Feb 5, 2013 at 15:16
  • 7
    I found another solution for the same problem hope it works you can easily right click in your service reference and then select configure and unchecked the reuse type in referenced assemblies it will work Feb 6, 2013 at 9:01
  • 1
    But what if I need to reuse type in referenced assemblies??!
    – Saw
    Feb 6, 2013 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.