On an Amazon Windows EC2 instance I've created a simple Windows Forms app in VS2017 Express that just logs to C:\Data\Databases\File.txt and opens up a sqlite database C:\Data\Databases\Database.db using Entity framework.
This works absolutely fine on my local machine and other machines when I install it.
Once I've installed it to the EC2 though, it doesn't look like sqlite works properly. The text log is written to, and when doing a FileExists, the database is found.
However as soon as it hits a "using"
public class databaseDB : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite(@"Filename=C:\Data\Databases\Database.db");
}
}
try
{
using (databaseDB db = new databaseDB())
{
StaticFunctions.WriteToLog("Selecting...");
}
}
catch (Exception ex)
{
StaticFunctions.WriteToLog("Error!");
StaticFunctions.WriteToLog(ex.InnerException.ToString());
}
the following error log is written:
System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. File name: 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. File name: 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
which I've read generally it means that SQLite isn't installed properly. I've tried registering various sqlite dll's on their own, but keep getting "The module was loaded but the entry-point DllRegisterServer was not found." error.
I've also read that copying the sqlite dll to the application directory sometimes works, but as it's an app, Windows seems to bury the installation somewhere that I can't get to.
What can I do to try and get this working?
Thanks!