OK, I did a quick code test, shown below:
public class OracleDbUtils
{
public static bool IsConnected()
{
try
{
using (var conn=new Oracle.ManagedDataAccess.Client.OracleConnection())
{
conn.ConnectionString = "xxxxxxxxxxxxxxxxxxxxxx";
}
return true;
}
catch
{
return false;
}
}
}
Since I do not have access to a Oracle database server, as you can see, I only wrote extremely simple code: as long as the execution passes the line
var conn = new OracleConnection()
then it means the Oracle DLLs are loaded successful. Here is the CommandMethod to call it:
[CommandMethod("TestDbConnection")]
public static void RunDocumentCommand()
{
var dwg = CadApp.DocumentManager.MdiActiveDocument;
var ed = dwg.Editor;
var connected = OracleDbUtils.IsConnected();
ed.WriteMessage(
$"Is AutoCAD connected to the database: {connected.ToString()}");
}
The code runs OK, meaning the Oracle DLLs from the NuGet Package is loaded into my AutoCAD 2025 successfully.
So, it seems that there could be other things being the source of the error.
It might be because of you somehow targeting Windows 10/Window SDK (Not sure if WinRT.runtime.dll even be compatible with AutoCAD)?
I'd suggest you create a pure Acad2025 plugin project and add the Oracle Nuget package (as I did) and verify the Oracle DLLs can be loaded. Then you gradually add other references.