Error on Xamarin project referencing OrmLite Sqlite package

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.

Thanks in advanced

Server Libraries like OrmLite are not supported on Mobile devices, just Service Clients and serialization libraries, i.e. (ServiceStack.Client / ServiceStack.Text).

Oh ok ok, got it. Too bad, the android version was working great,

Thanks a lot.

I hate to revive an old thread, but what would it take (or is it even possible) to adapt OrmLite to have a Sqlite component for Mobile (Xamarin)?

I’d be willing to work on this, if it’s even possible.

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();
1 Like

We did the same thing in our apps previously and add issue later. We add to fall back on sqllite “nuget packages” librairy.

Depending on your use case you might go further than us. At the time we want our IOS/Android apps with less code difference as possible.