admin管理员组文章数量:1366332
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ı!");
}
}
}
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ı!");
}
}
}
Share
Improve this question
edited 20 hours ago
marc_s
756k184 gold badges1.4k silver badges1.5k bronze badges
asked 20 hours ago
ozan aydemirozan aydemir
111 bronze badge
New contributor
ozan aydemir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1 Answer
Reset to default 0I think you're missing a reference to the AcCoreMgd.dll
本文标签: cClass Library (NET Framework) AutoCAD DLL Reference IssueCS0246 ErrorsStack Overflow
版权声明:本文标题:c# - Class Library (.NET Framework) AutoCAD DLL Reference Issue — CS0246 Errors - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743765478a2535153.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论