Forum Xamarin Cross Platform with Xamarin

Simple DataAccess PCL Library for Monotouch/Android/WindowsPhone

Hello!

I'm trying to create simple DataAccess portable class library for 3 platforms (ios, android, wp7.5).
All I want is to create webrequests, convert data and return it to UI of each platform.

I was able to create library like this (portable) under Mac OS X Xamarin Studio and successfully used it at iPhone app.
But then I opened this solution under Visual Studio (to add Windows Phone UI project) it gave me build error with description that it couldn't find System.Net namespace.
When I checked portable class targets I was surprised to see there even XBOX selected:
https://dl.dropboxusercontent.com/u/19503836/xamarin_targets.png

When I selected correct targets (MonoDroid/Monotouch/WindowsPhone7.5) I was able to compile but when I start the app I received the following error:

"c:\Downloads\Noname.CrossXam\Noname.CrossXam\Noname.CrossXam.iPhone\Noname.CrossXam.iPhone.csproj" (_RemoteBuild target) (1) ->
(_ResolveAssemblies target) ->
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.Common.targets(68,3): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. Perhaps it doesn't exist in the MonoTouch profile?
...

0 Warning(s)
1 Error(s)

Same code (same solution) works just fine under Mac OS X with Xamarin Studio.
Sample solution is attached

Please advise.

Posts

  • CTPAXCTPAX USMember

    The issue was in System.Net.dll assembly which is not exists under MonoTouch & MonoAndroid profiles. But that classes are implemented at System.dll under those profile and to make it work you need TypeForwardedToAttribute.

    All that type forwarding configuration exists at MVVMCross nuget package which I was able to install only after updating nuget (the last comment from this post: http://slodge.blogspot.com/2013/04/my-current-pcl-setup-in-visual-studio.html)

    So there were two issues:
    1. Old nuget package manager (update is required)
    2. TypeForwardedToAttribute configuration (exists at MvvmCross)

    Hope it will be useful for someone.

Sign In or Register to comment.