I’m getting the following error when compiling iOS project:
Error CS1703 Multiple assemblies with equivalent identity have been imported:
‘C:\Users\hp.nuget\packages\system.reflection.emit\4.3.0\ref\netstandard1.1\System.Reflection.Emit.dll’ and
‘C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\System.Reflection.Emit.dll’. Remove one of the duplicate references.
I wanted to take advantage of what I have already done in another project. I haven’t found a workaround if there is one for it.
I’m working with Visual Studio 2019. You can simply create a new Xamarin project, and add a reference to ServiceStack.OrmLite.Sqlite.Core package to the shared project, and you’ll get the error when compiling the iOS project.
Server Libraries like OrmLite are not supported on Mobile devices, just Service Clients and serialization libraries, i.e. (ServiceStack.Client / ServiceStack.Text).
It may just work on Android since it has access to a full Mono runtime, it’s unlikely to ever work on iOS due to its AOT restrictions but its unlikely we’ll ever support server libraries in Xamarin/iOS/Android since it’s historically been plagued with bugs and the time it takes to find work arounds doesn’t justify the time and effort lost.
FYI, I’m successfully using the ServiceStack.OrmLite.SqlLite.Data v5.11.0 package in a Xamarin Forms project. I’m not sure if its an artifact, but I do have references in both my common NetStandard2.0 library and my Android one. I also force-load the assembly in my Android MainActivity.cs:
// Force SQLite to load explicitly
object obj = new ServiceStack.OrmLite.Sqlite.SqliteOrmLiteDialectProvider();