Using Autofac in Xamarin

PT1PT1 USMember
edited January 2016 in Cross Platform with Xamarin

Hi Dear All,

One of Android class libraries in my solution references Autofac and it compiles fine one by one, but Android Application fails to compile with the following error:

Error 1 Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.ComponentModel.Composition, > > Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.ComponentModel.Composition.dll'
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List1 assemblies, AssemblyDefinition assembly) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List1 assemblies, AssemblyDefinition assembly)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List1 assemblies, AssemblyDefinition assembly) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List1 assemblies, AssemblyDefinition assembly)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute()

It looks like it's because Autofac references System.ComponentModel.Composition.dll. Is it possible to use Autofac in Xamarin?

Thanks!

Posts

  • MichaelDisantoMichaelDisanto USUniversity

    Has anyone used Autofac with Xamarin.Android ?

  • ChaseFlorellChaseFlorell CAInsider, University mod
    edited January 2016

    I use Autofac in all my applications. When you see an Autofac resolution exception, it's typically because of some other reason. Look at the message for a hint... sometimes it can be difficult.

    Note, you cannot resolve a dependency on Android that is not able to run on android.

Sign In or Register to comment.