Referencing Xamarin.iOS.dll and MonoAndroid.dll in Forms project?

LeloLelo Member ✭✭✭

Is it possible to reference Xamarin.iOS.dll and MonoAndroid.dll in Forms project?

I believe it was possible until recently in Visual Studio for Mac - but I might be mistaken. Also is it a limitation of the IDE or is there an actual architectural hinder to be able to do it?

Best Answer

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    I think these dll should be in platform specific projects. Why should you use them in XF project?
  • LeloLelo Member ✭✭✭
    edited August 15

    I am trying to get a shorter way of interacting with native code.

    Primarily I am looking to build multi targeted libraries in VSfM. I would like to be able to add new functionality on existing forms controls without having to subclass them. So I have created a platform-specific extension method that gives me UIKit.UIView on iOS - that possibly then can be cast down to it's specific native control. However I can't interact with it from Forms project or a NetStandardLibrary.

    When it comes to using it directly in Forms I am not sure though its completely beneficial. I was looking for a way it can be done in another mobile framework called NativeScript. However interacting with the native object might be cleaner when done via DependencyInjection. There will regardless be a benefit since a NuGet custom control could be downloaded - and then changed natively (at runtime).

    I think I will have use DependencyInjection via the platform specific projects to test it.

  • LeloLelo Member ✭✭✭

    @Amar_Bait said:
    You should have used then Shared library instead of .NET Standard when creating the project. In Shared library you can access all platforms (and differentiate between them with #ifdefs), as the Shared library code is not in an assembly itself, but will get compiled with each platform during building.

    Great! That will make it easier to test my platform-specific

  • LeloLelo Member ✭✭✭

    @Amar_Bait said:
    You should have used then Shared library instead of .NET Standard when creating the project. In Shared library you can access all platforms (and differentiate between them with #ifdefs), as the Shared library code is not in an assembly itself, but will get compiled with each platform during building.

    And what about in Visual Studio in Windows? I can't see that Shared Library/.Net Standard option.

Sign In or Register to comment.