Pan Markosian
Pan Markosian

Reputation: 101

Consume WCF service in Xamarin Cross Platform Application (Shared Project)

i try to consume a WCF service(SOAP) to my cross-platform app via shared project

  1. I add the WCF as service reference to the UWP project and call it to the namespace
    using MyApp.UWP.CalculateWCF;
    it works when running ONLY UWP

  2. I add the WCF as Web reference to the Android project and call it to the namespace
    using MyApp.Droid.CalculateWCF;
    it works when running ONLY Android

When trying to make preprocessor conditional statement like

#if __ANDROID__
using MyApp.Droid.CalculateWCF;
#else
using MyApp.UWP.CalculateWCF;
#endif

Output brings 1 error for Android and 1 for UWP

Error CS0246: The type or namespace name 'ICalculateWCFClient' could not be found (are you missing a using directive or an assembly reference?) (250, 25)

Error CS0246: The type or namespace name 'CalculateWCF' could not be found (are you missing a using directive or an assembly reference?) (290, 25)

Upvotes: 0

Views: 125

Answers (1)

Pan Markosian
Pan Markosian

Reputation: 101

The only way i found is to leave the shared project and convert it to .NET standard,

Then add the service in the base project though Microsoft WCF Web Service Reference Provider

Upvotes: 0

Related Questions