.net8 c# : Error in Visual Studio, with the "AeecDbMgd.dll" dll

.net8 c# : Error in Visual Studio, with the "AeecDbMgd.dll" dll

jb.boschung
Advocate Advocate
1,350 Views
2 Replies
Message 1 of 3

.net8 c# : Error in Visual Studio, with the "AeecDbMgd.dll" dll

jb.boschung
Advocate
Advocate

Good evening,

as a .net8 beginner, I'm encountering a problem in Visual Studio 2022, in C# and with the 'AeecDbMgd.dll' dll.
This dll is required to access the 'CivilDocument' class.

I've developed a very simple code that should enable me to display the identifiers of the pressurized networks I've created in a DWG file (Civil 3D).

using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;
using Autodesk.Civil.Runtime;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.Civil.Settings;
using System.Linq;


Console.WriteLine("Starting AutoCAD commands...");

// Obtient le document civil actif
CivilDocument civilDoc = CivilApplication.ActiveDocument;

// Appelle la méthode pour obtenir les IDs des réseaux de tuyaux sous pression
ObjectIdCollection networksIds = civilDoc.GetPressurePipeNetworkIds();


foreach (ObjectId networkId in networksIds)
{
    Console.WriteLine(networkId);
}

Console.WriteLine("Press any key to exit.");
Console.ReadKey();


In the Assemblies, I've added the following dlls:

jbboschung_0-1722795970053.png

 

And the dll is present according to its path: C:\Program Files\Autodesk\AutoCAD 2025\C3D\AeccDbMgd.dll
When I run the program, I get this error message:

jbboschung_1-1722796010623.png


We've also tried with the same dll but with the Civil 3D 2024 version, as well as several packages where it's present. We've also tried copying it locally, but to no avail, I still get this error message.

Any ideas?
Thanks in advance.




0 Likes
Accepted solutions (1)
1,351 Views
2 Replies
Replies (2)
Message 2 of 3

norman.yuan
Mentor
Mentor
Accepted solution

You did not say what type of excusable project you created, but it looks to me, your project is a console EXE app. You CANNOT use AutoCAD .NET API assemblies (accoremgd/acdbmgd/acmgd.dll) and C3D .NET API assemblies AecBaseMgd/AeccDbMgd.dll) in EXE apps; they can only run inside AutoCAD process, meaning you need to create .NET 8 class library, and loaded into AutoCAD as a plugin app.

 

Also, before doing C3D .NET API programming, you may want to start from basic AutoCAD .NET API programming, because C3D .NET programming is based on AutoCAD .NET API programming.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3

jb.boschung
Advocate
Advocate

Hello and thank you for your feedback.

It is indeed a console application that I had selected for my test without knowing that these dlls would not work in this type of executable.

I'll take your advice and start with basic AutoCAD .NET API programming.

Greetings

0 Likes