问题
So our enterprise is going the Xamarin route using Visual Studio. Going through all the documentation online showed that it should be Trivial to create WCF proxy client out of a web service and place it in the PCL. After Struggling and trying to figure out why I couldn't compile the PCL using the SLSVcUtil.exe generated classes or why the "Add Service Reference" menu item was missing i gave up and downloaded the sample projects.
Turns out what I was missing all along was the target profile for the PCL. With Visual Studio 2015 + Xamarin, the default profile was set to 111. Profile 111 as it turns out does not Include support WCF as it targets Windows Phone. The target profile you want to use if you want to use WCF is 78.
So how do you change the profile of the PCL in VS 2015? See the answer below. I truly hope this helps some one in the future.
回答1:
To change the profile:
- Right Click Properties on the PCL project.
- Click the "Change..." button on Targets Section
- Uncheck Windows Phone 8.1
- Check Windows Phone Silverlight 8.
- Clcik ok!
More information of Profiles: http://danrigby.com/2014/04/16/xamarin-pcl-profile-notes/
来源:https://stackoverflow.com/questions/36826467/visual-studio-2015-xamarin-native-portable-pcl-wcf