Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reuse MonoTouch library on MonoDroid

I was able to easily port an existing .NET desktop app to iPhone using MonoTouch. As part of that process, I had to create new iOS 'versions' of all my projects - MonoTouch class library projects linking the files from my existing projects. This works great.

Now I want to do a MonoDroid port. Can I just reference my iOS libraries? Or do they need to be MonoDroid class libraries?

The MonoTouch and MonoDroid profiles seem to be the same, based on the documentation:

http://monotouch.net/Documentation/Assemblies http://mono-android.net/Documentation/Assemblies

Has anyone used a MonoTouch class library with MonoDroid?

Thanks in advance

like image 409
TheNextman Avatar asked Apr 26 '11 00:04

TheNextman


1 Answers

If you're using MonoTouch 4.0, and the assembly doesn't reference monotouch.dll (directly or indirectly), then you just need to reference the assembly from your Mono for Android project.

Note that at this time you can only reference the assembly (.dll) and not the the Project (.csproj).

The reverse should also be true (reference a Mono for Android assembly and use in your MonoTouch project, as long as the Mono for Android assembly doesn't reference Mono.Android.dll).

If this breaks, please file a bug: we fully intend for the MonoTouch and Mono for Android APIs to be compatible with each other. (Whenever possible, that is; things such as System.Reflection.Emit will never be supported on both platforms unless/until Apple removes the JIT restriction.)

like image 177
jonp Avatar answered Sep 27 '22 23:09

jonp