question

SatishSingh-2686 avatar image
0 Votes"
SatishSingh-2686 asked ·

WCF service cannot reference a UWP class library

Hi,

Recently I have been trying to make a UWP version of a sample WPF Interface program written by Jeremy Clark (https://github.com/jeremybytes/learning-interfaces).

In my program, I am using "UWP Class Library" instead of ".NET Framework Class Library". While I am able to reference a WCF service from UWP class library, I am getting an error when I am trying to reference the UWP class library from the WCF service. The exact error message I am getting is "Unable to add reference to project".

Next, I replaced all UWP class library to .NET Framework class library. Now I could reference it from the WCF service. However, now I cannot reference the .NET class library from a UWP blank app.

I even tried using ".NET Standard Class Library". However, calling a service reference from it creates a very different ServiceClient class with some standard methods like GetData() missing from the class.

I would like to use UWP Class Library. Kindly suggest a way in which I could reference it from WCF service.

windows-uwp-runtime
10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

alextjahjana avatar image
0 Votes"
alextjahjana answered ·

Hi,

Have you tried to reference System.Runtime.Serialization.Primitives.dll as this post suggested: https://stackoverflow.com/questions/34292295/how-to-share-a-library-between-a-wcf-service-application-and-a-uwp-app ?
I think you can download it at: http://www.microsoft.com/en-us/download/details.aspx?id=40727

· 1
10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

But I think with .Net Standard 2.0, PCL has now become obsolete. I do not want to use PCL because it is very limiting. Instead, if I could not reference a UWP class library from a WCF, I would rather prefer .Net Standard class library. The only problem with it is that it returns asynchronous objects in the ServiceClient class.

0 Votes 0 ·