core icon indicating copy to clipboard operation
core copied to clipboard

Missing dependancy on linux

Open hafarooki opened this issue 8 years ago • 10 comments

I tried running my dotnet core application on Ubuntu but I get this error:

admin@ns532585:~/starlegacywebsite$ dotnet starlegacy.net.dll Error: An assembly specified in the application dependencies manifest (starlegacy.net.deps.json) was not found: package: 'Antlr3.Runtime', version: '3.5.1' path: 'lib/netstandard1.1/Antlr3.Runtime.dll'

hafarooki avatar May 24 '18 06:05 hafarooki

The Antlr3.Runtime seems to exist in the publish folder. If I try running it in the publish folder, I get this:

---> NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=5.1.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NHibernate.HibernateException: The DbCommand and DbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly. at NHibernate.Driver.ReflectionBasedDriver..ctor(String providerInvariantName, String driverAssemblyName, String connectionTypeName, String commandTypeName)

But it works on my local testing

hafarooki avatar May 24 '18 06:05 hafarooki

After some fiddling I get this: ---> NHibernate.HibernateException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll': The specified module or one of its dependencies could not be found. the dll is in the same folder though...

hafarooki avatar May 24 '18 06:05 hafarooki

in the past on .NET framework the SQLite.dll had to be on x86 or x64 subfolder, not sure if its the case anymore

furoraest avatar May 24 '18 07:05 furoraest

I tried uploading SQLite.Interop.dll files to both x64, x86, publish/x64, and publish/x86. Sadly, none of them worked.

hafarooki avatar May 24 '18 07:05 hafarooki

@Miclebrick Do not know if this will help you, but we use SQLite with dotnet core on Ubuntu. To be able to run on Linux we had to add these packages:

<PackageReference Include="Microsoft.Data.SQLite" Version="2.0.0" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.9" />

Note that there are newer releases, I just copied from our csproj. Works like a charm on Win, Mac, Linux (ARM as well)

uffebjorklund avatar May 24 '18 08:05 uffebjorklund

Had to change it from 2.0.0 to 2.0.1 to get it to compile, but after that it worked perfectly fine locally. Going to test it remotely... (Hard to test it remotely when it refuses to upload faster than 1 MB/s)

hafarooki avatar May 24 '18 08:05 hafarooki

@uffebjorklund That didn't work... what nuget package do you use for SQLite? Maybe whichever one you are using would work better. I have System.Data.SQLite.Core.

hafarooki avatar May 24 '18 08:05 hafarooki

Oh, I'm stupid.... package references ARE nuget packets

hafarooki avatar May 24 '18 08:05 hafarooki

To get it to use Microsoft.Data.SQLite instead of System.Data.SQLite I had to use this: https://github.com/milestonetg/nhibernate-sqlite

hafarooki avatar May 24 '18 08:05 hafarooki

That worked! Thanks for your help.

hafarooki avatar May 24 '18 08:05 hafarooki