1

I'm trying to develop an AutoCAD plugin using the AutoCAD .NET API, but I'm facing a serious issue with DLL references. I'm constantly getting CS0246 and similar "type or namespace not found" errors, and I can't proceed further. I’d really appreciate help from anyone experienced in this area.

My goal: I want to dynamically manage block attribute data inside AutoCAD and build a custom rebar detailing system via .NET. I've been doing this for a long time using AutoLISP, but now I want to build a more stable and reliable system using .NET.

Environment:

AutoCAD Versions Tested: 2021, 2023, currently testing with 2017

Visual Studio: 2022 Community (latest version)

.NET Framework: 4.8

Platform Target: x64

Referenced DLLs:

acmgd.dll
acdbmgd.dll
(Referenced from: C:\Program Files\Autodesk\AutoCAD 2023)

Error:

CS0246: The type or namespace name 'CommandMethod' could not be found
CS0246: The type or namespace name 'Editor' could not be found
CS0246: The type or namespace name 'Document' could not be found
CS0117: 'Application' does not contain a definition for 'DocumentManager'

I suspect it's related to missing namespaces or improperly loaded DLLs, but I couldn't find a solid solution.

Any advice or working example setup would be greatly appreciated. Thanks in advance to anyone willing to help!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using System.Xml.Linq;
namespace DonatiOtomatik
{
 public class DonatiKomut
 {
 [CommandMethod("TESTKOMUT")]
 public void Yazdir()
 {
 Document doc = Application.DocumentManager.MdiActiveDocument;
 Editor ed = doc.Editor;
 ed.WriteMessage("\nMerhaba .NET dünyası!");
 }
 }
}
marc_s
760k186 gold badges1.4k silver badges1.5k bronze badges
asked Apr 3, 2025 at 14:56

1 Answer 1

0

I think you're missing a reference to the AcCoreMgd.dll

answered Apr 4, 2025 at 9:02
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.