To get MonoTouch and MonoDroid building with portable library project references in VS2010:
- Install the Portable Library tools - http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981
- Install VSMonoTouch -
https://github.com/follesoe/VSMonoTouch
- be sure to also copy across the v1.0 framework assemblies in the instructions there - Follow the instructions on
http://jpobst.blogspot.co.uk/2012/04/mono-for-android-portable-libraries-in.html
- which basically say to install a file called "MonoAndroid,Version=v1.6+.xml" in "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile2\SupportedFrameworks" with content:
<?xml version="1.0" encoding="utf-8"?><Framework DisplayName="Mono for Android" Identifier="MonoAndroid" MaximumVersion="*" MinimumVersion="1.6" Profile="*"/> - Installl a similar file called "VSMonoTouch,Version=v1.0+.xml" in the same directory and for its content use:
<?xml version="1.0" encoding="utf-8"?><Framework DisplayName="VS MonoTouch" Identifier=".NETFramework" MaximumVersion="1.0" MinimumVersion="1.0" Profile="*" />(Note: this file is even hackier than the MonoDroid one - it points the portable tools at Full .Net v1.0 in line with what the VSMonoTouch plugin does!) - That's it!
Although.... if you do want to use System.Net classes within MonoDroid, then you'll also need to add a proxy assembly for it - a MonoDroid class library project producing a DLL called System.Net and containing a single C# file with contents:
using System.Runtime.CompilerServices; /* * not available in MonoDroid :/ [assembly: TypeForwardedTo(typeof(System.Net.Sockets.UdpAnySourceMulticastClient))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.UdpSingleSourceMulticastClient))] [assembly: TypeForwardedTo(typeof(System.Net.DnsEndPoint))] [assembly: TypeForwardedTo(typeof(System.Net.WriteStreamClosedEventHandler))] [assembly: TypeForwardedTo(typeof(System.Net.WriteStreamClosedEventArgs))] */ [assembly: TypeForwardedTo(typeof(System.Net.Cookie))] [assembly: TypeForwardedTo(typeof(System.Net.CookieCollection))] [assembly: TypeForwardedTo(typeof(System.Net.CookieContainer))] [assembly: TypeForwardedTo(typeof(System.Net.CookieException))] [assembly: TypeForwardedTo(typeof(System.Net.Dns))] [assembly: TypeForwardedTo(typeof(System.Net.EndPoint))] [assembly: TypeForwardedTo(typeof(System.Net.WebProxy))] [assembly: TypeForwardedTo(typeof(System.Net.HttpRequestHeader))] [assembly: TypeForwardedTo(typeof(System.Net.HttpStatusCode))] [assembly: TypeForwardedTo(typeof(System.Net.HttpVersion))] [assembly: TypeForwardedTo(typeof(System.Net.DecompressionMethods))] [assembly: TypeForwardedTo(typeof(System.Net.WebRequest))] [assembly: TypeForwardedTo(typeof(System.Net.HttpWebRequest))] [assembly: TypeForwardedTo(typeof(System.Net.WebResponse))] [assembly: TypeForwardedTo(typeof(System.Net.HttpWebResponse))] [assembly: TypeForwardedTo(typeof(System.Net.ICertificatePolicy))] [assembly: TypeForwardedTo(typeof(System.Net.ICredentials))] [assembly: TypeForwardedTo(typeof(System.Net.HttpContinueDelegate))] [assembly: TypeForwardedTo(typeof(System.Net.IPAddress))] [assembly: TypeForwardedTo(typeof(System.Net.IPEndPoint))] [assembly: TypeForwardedTo(typeof(System.Net.IPHostEntry))] [assembly: TypeForwardedTo(typeof(System.Net.IWebRequestCreate))] [assembly: TypeForwardedTo(typeof(System.Net.NetworkCredential))] [assembly: TypeForwardedTo(typeof(System.Net.ProtocolViolationException))] [assembly: TypeForwardedTo(typeof(System.Net.ServicePoint))] [assembly: TypeForwardedTo(typeof(System.Net.ServicePointManager))] [assembly: TypeForwardedTo(typeof(System.Net.WebHeaderCollection))] [assembly: TypeForwardedTo(typeof(System.Net.SocketAddress))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SocketException))] [assembly: TypeForwardedTo(typeof(System.Net.WebClient))] [assembly: TypeForwardedTo(typeof(System.Net.OpenReadCompletedEventHandler))] [assembly: TypeForwardedTo(typeof(System.Net.OpenReadCompletedEventArgs))] [assembly: TypeForwardedTo(typeof(System.Net.OpenWriteCompletedEventHandler))] [assembly: TypeForwardedTo(typeof(System.Net.OpenWriteCompletedEventArgs))] [assembly: TypeForwardedTo(typeof(System.Net.DownloadStringCompletedEventHandler))] [assembly: TypeForwardedTo(typeof(System.Net.DownloadStringCompletedEventArgs))] [assembly: TypeForwardedTo(typeof(System.Net.UploadStringCompletedEventHandler))] [assembly: TypeForwardedTo(typeof(System.Net.UploadStringCompletedEventArgs))] [assembly: TypeForwardedTo(typeof(System.Net.DownloadProgressChangedEventHandler))] [assembly: TypeForwardedTo(typeof(System.Net.DownloadProgressChangedEventArgs))] [assembly: TypeForwardedTo(typeof(System.Net.UploadProgressChangedEventHandler))] [assembly: TypeForwardedTo(typeof(System.Net.UploadProgressChangedEventArgs))] [assembly: TypeForwardedTo(typeof(System.Net.WebException))] [assembly: TypeForwardedTo(typeof(System.Net.WebExceptionStatus))] [assembly: TypeForwardedTo(typeof(System.Net.NetworkInformation.NetworkAddressChangedEventHandler))] [assembly: TypeForwardedTo(typeof(System.Net.NetworkInformation.NetworkChange))] [assembly: TypeForwardedTo(typeof(System.Net.NetworkInformation.NetworkInterface))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.AddressFamily))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.LingerOption))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.MulticastOption))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.IPv6MulticastOption))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.Socket))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.ProtocolType))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SelectMode))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SocketAsyncOperation))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SocketAsyncEventArgs))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SocketError))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SocketFlags))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SocketOptionLevel))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SocketOptionName))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SocketShutdown))] [assembly: TypeForwardedTo(typeof(System.Net.Sockets.SocketType))]
This approach based on a hint in http://stackoverflow.com/questions/10361457/is-it-possible-to-use-a-portable-class-library-that-references-system-net-in-mon
I will blog more about this stuff... when I get the final part working - which is building these projects in MonoDevelop on the Mac - currently that's #fail :(