none
Consuming SharePoint 2010 WCF from .Net 4.5 + Store portable class library (PCL) RRS feed

  • Question

  • Hi there,

    Can VS2012 build a proxy in a PCL project to consume a WCF service for SP2010? We add a reference (old school works everywhere else) but once we make calls, for instance GetListsCollectionAsync(), we get all sorts of errors. When we build the proxy, VS gives a warning:

    Service proxy generation failed. Proxy requires type 'System.Xml.Linq.XElement' which is not supported in portable libraries

    Has anyone successfully subscribed to a SharePoint WCF using a portable class library? The same stuff works fine in .net 4.5 class libraries and in metro libraries. only portable ones give us this problem. we have win 7 and win 8 devices in the mix - so PCL would be a really good fit.

    Kind regards,

    Gregor

    Tuesday, April 30, 2013 9:45 PM

Answers

  • Got a conclusion here: We found a work around and the statement that this is a bug in VS2012 PCL projects still stands.

    We created our proxy in a metro project and simply copied the reference.cs file over into the PCL project. It was a "what the heck - why not" last attempt of sorts, but it actually works. Even better, the calls are awaitable and come with response objects. Awesome!

    Cheers,

    Gregor

    • Marked as answer by gv73 Wednesday, May 1, 2013 9:33 PM
    Wednesday, May 1, 2013 9:33 PM

All replies

  • Hi, it seems the root cause with this issue is not related to WCF, please look for a more appropriate forum for the question. Not sure if if it is ok using portable class library in sharepoint properly, so Sharepoint forum maybe better for this question.

    Wednesday, May 1, 2013 8:46 AM
  • There is a standard "feature" in VS2012 that generates Service References. We use it to consume wcf services (for instance the lists.asmx of SP2010) all the time. The wcf works. The "feature" fails to get the proxy right for pcl projects.

    The question was moved from the metro forum - I thought those folks may deal with pcl's consuming wcf services more.

    to me it's a VS2012 bug. I want to know if that is the case and/or if there is a work around.

    Wednesday, May 1, 2013 12:01 PM
  • Got a conclusion here: We found a work around and the statement that this is a bug in VS2012 PCL projects still stands.

    We created our proxy in a metro project and simply copied the reference.cs file over into the PCL project. It was a "what the heck - why not" last attempt of sorts, but it actually works. Even better, the calls are awaitable and come with response objects. Awesome!

    Cheers,

    Gregor

    • Marked as answer by gv73 Wednesday, May 1, 2013 9:33 PM
    Wednesday, May 1, 2013 9:33 PM