我正在Xamarin PCL开发一个项目跨平台我正在使用Visual Studio 2015 V4.6在IOS和android上进行测试。我需要在我的可移植类中包含System.ServiceModel以使用WCF服务。我不能将它包含在Nuget Packets中。
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.
我试图在参考文献中直接包含右clic - > 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但没有任何反应。 有人能帮我吗?提前致谢
告诉我您是否需要更多详细信息。 在此先感谢您的帮助。
答案 0 :(得分:0)
您好,您无法直接将您的WCf服务添加到您的Portable类库中,我建议您在wcf rest服务中转换您的wcf服务。我让你看教程
如果您绝对需要wsdl服务,也可以按照本教程进行操作。你可以使用最后的xamarin版本直接在你的pcl类中添加它 https://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_WCF/