Here’s how I produced the error.
- Create a class library
- Add a reference to CouchBaseLite
- Create a WPF application
- Add a reference to the class library in the WPF application
- Run the application
The LiteCore.dll file in the bin\debug\x64 and bin\debug\x86 folders in the class library are not copied to the WPF application
Here’s the full error message.
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for ‘Couchbase.Lite.Internal.Logging.WriteLog’ threw an exception.
Source=Couchbase.Lite
StackTrace:
at Couchbase.Lite.Internal.Logging.WriteLog.get_To()
at Couchbase.Lite.DatabaseConfiguration.set_Directory(String value)
at InfrastructureLib.Repository.ExternalRepositoryServiceProvider.Inject() in C:\Users\REMOVED\Documents\GitHub\sqlserverapplication\InfrastructureLib\Repository\ExternalRepositoryServiceProvider.cs:line 42
at UserInterface.App.InfrastructureInjector() in C:\Users\REMOVED\Documents\GitHub\sqlserverapplication\UserInterface\App.xaml.cs:line 274
at UserInterface.App.OnStartup(StartupEventArgs e) in C:\Users\REMOVED\Documents\GitHub\sqlserverapplication\UserInterface\App.xaml.cs:line 126
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
This exception was originally thrown at this call stack:
Couchbase.Lite.Support.NetDesktop.LoadLiteCore() in Activate.cs
[External Code]
Inner Exception 1:
TypeInitializationException: The type initializer for ‘LiteCore.Interop.Native’ threw an exception.
Inner Exception 2:
DllNotFoundException: Could not find LiteCore.dll! Nothing is going to work!
Tried searching in:
C:\Users\REMOVED\Documents\GitHub\sqlserverapplication\UserInterface\runtimes\win7-x86\native\LiteCore.dll
C:\Users\REMOVED\Documents\GitHub\sqlserverapplication\UserInterface\bin\Debug\x86\LiteCore.dll
C:\Users\REMOVED\Documents\GitHub\sqlserverapplication\UserInterface\bin\Debug\bin\x86\LiteCore.dll