greenhoorn
greenhoorn

Reputation: 1561

Xamarin.Forms assembly references

I am developing a Xamarin.Forms application for Android and iOS. The pcl project grew quite a lot and has many nuget packages installed like FluentValidation, SQlite and Newtonsoft.Json. The platform specific projects only have a few lines of code like custom renderer and stuff. The only references they have, is SQlite.

Now this works just fine when compiling for Android. However, when trying to build for iOS, I get an error -> Can not resolve reference (System.EnterpriseServices.Wrapper.dll).

My question is not specific to this dll, furthermore I'd like to know how it really works. I was assuming, I can install whatever package I want into the pcl project. Is there a limitation? Do the packages have to be compatible with Xamarin.iOS / Xamarin.Android? How am I able to track, where the dll actually comes from?

Why does it work in Android but not in iOS?

Upvotes: 2

Views: 2226

Answers (1)

Joehl
Joehl

Reputation: 3701

Yes, there are limitations between the platforms. The different assemblies and/or nuget-packages you use in the PCL-project, need to be comaptible for the platforms you are targeting.

The reason is quite simple: When you build your iOS-project, the PCL project is also building for the iOS target, and therefore the assemblies need to be compatible. The assemblies are just a subset.

Xamarin.iOS, Xamarin.Android, and Xamarin.Mac all ship with over a dozen assemblies. Just as Silverlight is an extended subset of the desktop .NET assemblies, Xamarin platforms is also an extended subset of several Silverlight and desktop .NET assemblies.

When you want to use an assembly, which is only compatible for android, then add it in the android-project and not in the PCL project.

You can find a list with supported assemblies over the platforms on the Xamarin Developer page.

On this list you can see, that System.EnterpriseServices.dll is only available for android and not for iOS. Additionaly you cand find some limitations using SQLite/System.Data on the iOS platforms on this page.

Upvotes: 2

Related Questions