Код: Выделить всё
DLLtest.csprojКод: Выделить всё
Exe
net9.0
enable
enable
$(OutputPath)dll\
dll\SQLite.dll
true
PreserveNewest
dll\%(Filename)%(Extension)
Код: Выделить всё
{
"runtimeOptions": {
"tfm": "net9.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.0.0"
},
"additionalProbingPaths": [
"dll"
]
}
}
Код: Выделить всё
Код: Выделить всё
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'SQLite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'SQLite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
at DLLTest.Program.Main(String[] args)
< /code>
Согласно запросу: < /p>
Код выполнения, который получает ошибку: < /p>
using SQLite_Operations
namespace DLLTest
{
public class Program
{
static void Main(string[] args)
{
int dur = SQLite.Open("chinook.db");
dur = SQLite.Close();
}
}
}
< /code>
фрагмент из кода DLL: < /p>
namespace SQLite_Operations;
public class SQLite
{
protected static IntPtr db;
protected static IntPtr arg;
protected static IntPtr errmsg;
// DLL Function Imports
[DllImport(".\\sqlite3.dll", EntryPoint = "sqlite3_open")]
private static extern int sqlite3_open(string filename, out IntPtr db);
[DllImport(".\\sqlite3.dll", EntryPoint = "sqlite3_close")]
private static extern int sqlite3_close(IntPtr db);
public static int Open(string filename)
{
return sqlite3_open(filename, out db);
}
public static int Close()
{
return sqlite3_close(db);
}
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... references
Мобильная версия