【问题标题】:XAMARIN PCL consumming WCFXAMARIN PCL 消费 WCF
【发布时间】:2016-11-18 16:18:41
【问题描述】:

我正在 Xamarin PCL 中开发一个跨平台项目,我正在使用 Visual Studio 2015 V4.6 在 IOS 和 android 上进行测试。我需要在我的可移植类中包含 System.ServiceModel 以使用 WCF 服务。我无法将它包含在 Nuget 数据包中。

Could not install package 'System.ServiceModel.Primitives 4.3.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.           

我尝试直接包含Right clic on References -> path->System.ServiceModel[4.0.0.0] 然后添加* 我有这个错误信息

  ' Severity    Code    Description Project File    Line    Suppression State
Error       Can not resolve reference: /Users/ludovic/Library/Caches/Xamarin/mtbs/builds/DemoHandyLife.iOS/725fe7b4d3cb829a82e1002d425b8f86/bin/iPhoneSimulator/Debug/System.EnterpriseServices.Wrapper.dll DemoHandyLife.iOS   C:\Program Files\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets 696'    

如果我添加 System.ServiceModel[5.0.0.0] 我有这些错误消息

Error   CS0012  The type 'CookieContainer' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.  


Error   CS0012  The type 'CookieContainer' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.  

我尝试自动添加 system.Net Version=5.0.5.0 但没有任何反应。 有人能帮我吗?提前致谢

如果您需要更多详细信息,请告诉我。 提前感谢您的帮助。

【问题讨论】:

    标签: c# android wcf xamarin.ios cross-platform


    【解决方案1】:

    您好,您不能直接将您的 WCf 服务添加到您的 Portable 类库中,我建议您将您的 wcf 服务转换为 wcf 休息服务。我让你看教程

    如果您绝对想要 wsdl 服务,也可以按照本教程进行操作。您可以使用最新的 xamarin 版本将其直接添加到您的 pcl 类中 https://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_WCF/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-19
      • 2014-05-04
      • 1970-01-01
      • 2016-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多