Reusing MonoTouch Library on MonoDroid

I was able to easily port my existing .NET application for iPhone to iPhone using MonoTouch. As part of this process, I had to create new iOS versions of all my projects - MonoTouch class library projects linking files to my existing projects. This works great.

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

MonoTouch and MonoDroid profiles seem the same based on the documentation:

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

Has anyone used the MonoTouch class library with MonoDroid?

Thanks in advance

+6
source share
2 answers

If you are using MonoTouch 4.0 and the assembly does not reference monotouch.dll (directly or indirectly), you just need to reference the assembly from the Mono project for Android.

Please note that at this time you can only reference the assembly ( .dll ) and not the project ( .csproj ).

The converse should also be true (refer to the Mono build for Android and use MonoTouch in your project until the Mono build for Android references Mono.Android.dll ).

If this breaks down, write a mistake: we are fully committed to supporting MonoTouch and Mono compatibility for the Android API. (If possible, things like System.Reflection.Emit will never be supported on both platforms unless / until Apple removes the JIT restriction.)

+6
source

We had the same problem with trying to share code between MonoDroid and MonoTouch. The way we solved this in our project was to have a standard class library containing common code and the MonoDroid and MonoTouch class library, where we added file links (you add an existing file to the project and select "Add as link" )

0
source

Source: https://habr.com/ru/post/886669/


All Articles