<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Could not load file or assembly 'Acdbmgd, Version=22.0.0.0 in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332666#M16379</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I fixed my project as you suggested but now when I run the dll file in autocad using netload my command doesn't show up. I have autocad 2018, and VS2019. Below is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using System;&lt;BR /&gt;using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;using Autodesk.AutoCAD.DatabaseServices;&lt;BR /&gt;using Autodesk.AutoCAD.Geometry;&lt;BR /&gt;using Autodesk.AutoCAD.EditorInput;&lt;/P&gt;&lt;P&gt;namespace Pranav_&lt;BR /&gt;{&lt;BR /&gt;public class Class1&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;[CommandMethod("InsBlockPranav")]&lt;BR /&gt;public void InsertBlock()&lt;BR /&gt;{&lt;BR /&gt;Point3d insPt = new Point3d(0, 0, 0);&lt;BR /&gt;string blockName = "C:/Users/E_Cable.dwg";&lt;/P&gt;&lt;P&gt;var doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;var db = doc.Database;&lt;BR /&gt;var ed = doc.Editor;&lt;BR /&gt;using (var tr = db.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;// check if the block table already has the 'blockName'" block&lt;BR /&gt;var bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);&lt;BR /&gt;if (!bt.Has(blockName))&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;// search for a dwg file named 'blockName' in AutoCAD search paths&lt;BR /&gt;var filename = HostApplicationServices.Current.FindFile(blockName + ".dwg", db, FindFileHint.Default);&lt;BR /&gt;// add the dwg model space as 'blockName' block definition in the current database block table&lt;BR /&gt;using (var sourceDb = new Database(false, true))&lt;BR /&gt;{&lt;BR /&gt;sourceDb.ReadDwgFile(filename, FileOpenMode.OpenForReadAndAllShare, true, "");&lt;BR /&gt;db.Insert(blockName, sourceDb, true);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;catch&lt;BR /&gt;{&lt;BR /&gt;ed.WriteMessage($"\nBlock '{blockName}' not found.");&lt;BR /&gt;return;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// create a new block reference&lt;BR /&gt;using (var br = new BlockReference(insPt, bt[blockName]))&lt;BR /&gt;{&lt;BR /&gt;var space = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);&lt;BR /&gt;space.AppendEntity(br);&lt;BR /&gt;tr.AddNewlyCreatedDBObject(br, true);&lt;BR /&gt;}&lt;BR /&gt;tr.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Sun, 23 May 2021 04:14:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-05-23T04:14:27Z</dc:date>
    <item>
      <title>Could not load file or assembly 'Acdbmgd, Version=22.0.0.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332576#M16375</link>
      <description>&lt;P&gt;I get following exception when I debug the code below, can anyone help what is the reason? I am not able to find solution in the forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="csharp.JPG" style="width: 529px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/921803iC0221F72CEC0BC72/image-size/large?v=v2&amp;amp;px=999" role="button" title="csharp.JPG" alt="csharp.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have following dependencies:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="csharp2.JPG" style="width: 446px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/921804iA6325909F8C91BA1/image-size/large?v=v2&amp;amp;px=999" role="button" title="csharp2.JPG" alt="csharp2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using System;&lt;BR /&gt;using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;using Autodesk.AutoCAD.DatabaseServices;&lt;BR /&gt;using Autodesk.AutoCAD.Geometry;&lt;/P&gt;&lt;P&gt;namespace HelloWorld&lt;BR /&gt;{&lt;BR /&gt;class Program&lt;BR /&gt;{&lt;BR /&gt;static void Main(string[] args)&lt;BR /&gt;{&lt;BR /&gt;Point3d point1 = new Point3d(0, 0, 0);&lt;BR /&gt;string blkN = "C:/E_Cable.dwg";&lt;/P&gt;&lt;P&gt;InsertBlock(point1, blkN);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;public static void InsertBlock(Point3d insPt, string blockName)&lt;BR /&gt;{&lt;BR /&gt;var doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;var db = doc.Database;&lt;BR /&gt;var ed = doc.Editor;&lt;BR /&gt;using (var tr = db.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;// check if the block table already has the 'blockName'" block&lt;BR /&gt;var bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);&lt;BR /&gt;if (!bt.Has(blockName))&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;// search for a dwg file named 'blockName' in AutoCAD search paths&lt;BR /&gt;var filename = HostApplicationServices.Current.FindFile(blockName + ".dwg", db, FindFileHint.Default);&lt;BR /&gt;// add the dwg model space as 'blockName' block definition in the current database block table&lt;BR /&gt;using (var sourceDb = new Database(false, true))&lt;BR /&gt;{&lt;BR /&gt;sourceDb.ReadDwgFile(filename, FileOpenMode.OpenForReadAndAllShare, true, "");&lt;BR /&gt;db.Insert(blockName, sourceDb, true);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;catch&lt;BR /&gt;{&lt;BR /&gt;ed.WriteMessage($"\nBlock '{blockName}' not found.");&lt;BR /&gt;return;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// create a new block reference&lt;BR /&gt;using (var br = new BlockReference(insPt, bt[blockName]))&lt;BR /&gt;{&lt;BR /&gt;var space = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);&lt;BR /&gt;space.AppendEntity(br);&lt;BR /&gt;tr.AddNewlyCreatedDBObject(br, true);&lt;BR /&gt;}&lt;BR /&gt;tr.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 02:28:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332576#M16375</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-23T02:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: Could not load file or assembly 'Acdbmgd, Version=22.0.0.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332590#M16376</link>
      <description>&lt;P&gt;The AutoCAD .NET reference assemblies (accoremgd/acdbmgd/acmgd.dll) CANNOT be used in stand-alone EXE application. They can only be used in .NET framework class library DLL project and loaded into AutoCAD via AutoCAD command "NETLOAD" or AutoCAD's auto-loading configuration.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 02:41:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332590#M16376</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-05-23T02:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Could not load file or assembly 'Acdbmgd, Version=22.0.0.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332595#M16377</link>
      <description>&lt;P&gt;This is .cs file. My goal is to load the dll file from successful debug to autocad using netload. What am I missing here?&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 02:46:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332595#M16377</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-23T02:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Could not load file or assembly 'Acdbmgd, Version=22.0.0.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332598#M16378</link>
      <description>&lt;P&gt;Ah makes sense. Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 02:48:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332598#M16378</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-23T02:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Could not load file or assembly 'Acdbmgd, Version=22.0.0.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332666#M16379</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I fixed my project as you suggested but now when I run the dll file in autocad using netload my command doesn't show up. I have autocad 2018, and VS2019. Below is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using System;&lt;BR /&gt;using Autodesk.AutoCAD.Runtime;&lt;BR /&gt;using Autodesk.AutoCAD.ApplicationServices;&lt;BR /&gt;using Autodesk.AutoCAD.DatabaseServices;&lt;BR /&gt;using Autodesk.AutoCAD.Geometry;&lt;BR /&gt;using Autodesk.AutoCAD.EditorInput;&lt;/P&gt;&lt;P&gt;namespace Pranav_&lt;BR /&gt;{&lt;BR /&gt;public class Class1&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;[CommandMethod("InsBlockPranav")]&lt;BR /&gt;public void InsertBlock()&lt;BR /&gt;{&lt;BR /&gt;Point3d insPt = new Point3d(0, 0, 0);&lt;BR /&gt;string blockName = "C:/Users/E_Cable.dwg";&lt;/P&gt;&lt;P&gt;var doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;var db = doc.Database;&lt;BR /&gt;var ed = doc.Editor;&lt;BR /&gt;using (var tr = db.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;// check if the block table already has the 'blockName'" block&lt;BR /&gt;var bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);&lt;BR /&gt;if (!bt.Has(blockName))&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;// search for a dwg file named 'blockName' in AutoCAD search paths&lt;BR /&gt;var filename = HostApplicationServices.Current.FindFile(blockName + ".dwg", db, FindFileHint.Default);&lt;BR /&gt;// add the dwg model space as 'blockName' block definition in the current database block table&lt;BR /&gt;using (var sourceDb = new Database(false, true))&lt;BR /&gt;{&lt;BR /&gt;sourceDb.ReadDwgFile(filename, FileOpenMode.OpenForReadAndAllShare, true, "");&lt;BR /&gt;db.Insert(blockName, sourceDb, true);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;catch&lt;BR /&gt;{&lt;BR /&gt;ed.WriteMessage($"\nBlock '{blockName}' not found.");&lt;BR /&gt;return;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// create a new block reference&lt;BR /&gt;using (var br = new BlockReference(insPt, bt[blockName]))&lt;BR /&gt;{&lt;BR /&gt;var space = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);&lt;BR /&gt;space.AppendEntity(br);&lt;BR /&gt;tr.AddNewlyCreatedDBObject(br, true);&lt;BR /&gt;}&lt;BR /&gt;tr.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 04:14:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10332666#M16379</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-23T04:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Could not load file or assembly 'Acdbmgd, Version=22.0.0.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10333214#M16380</link>
      <description>&lt;P&gt;Well, it would be better if you clearly described what exactly occurred after you "netloaded" your DLL and entered your command ("InsBlockPranav"), than simply said "...dosn't show up": what did you see at command line: nothing? or message, something like "Unknown command, Press F1 for help"?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume you got "unknown command" error, which usually is the result of these possible issues:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Wrong version of .NET framework. With Acad2018, you can use 4.6x (or 4.5x, I cannot remember) to 4.8x.&lt;/P&gt;
&lt;P&gt;2. Wrong version of AutoCAD managed assembly references (accoremgd/acdbmgd/acmdg.dll). Where the reference DLLs you use are from?&lt;/P&gt;
&lt;P&gt;3. You need to make sure the Acad refernce assemblies in your project's Copy Local property is set to False (i.e. if you find the 3 references DLLs end up in the same folder as your custom DLL, the Copy Local property is true, which is wrong, especially, if the referenced DLLs are from ObjectARX SDK).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The most likely reason of "unknown command" error from Acad .NET newbie's code is 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, assume you eventually get your command working (I strongly recommend you try your very first command with simpliest code, i.e. "Hello world" type of code), the code in your first command method has numeral errors and would not work. Once you get your command recognized, you might, or might not, be able step the code through in debugging to find out what are wrong in the code, depending on your AutoCAD programming knowledge. Hint: you cannot use a block file name (with path!) as block name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 May 2021 13:41:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10333214#M16380</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-05-23T13:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Could not load file or assembly 'Acdbmgd, Version=22.0.0.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10333945#M16381</link>
      <description>&lt;P&gt;I installed .net framework 4.8 and now it works. It was not giving me any errors in autocad after netload on .net framework 5.0. and autocad 2018. thanks again&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 00:30:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10333945#M16381</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-24T00:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Could not load file or assembly 'Acdbmgd, Version=22.0.0.0</title>
      <link>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10335125#M16382</link>
      <description>&lt;P&gt;AutoCAD uses .NET Framework, which ends with 4.8 as its very last version and is not part of .NET 5 (and soon coming .NET 6).&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 13:10:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/could-not-load-file-or-assembly-acdbmgd-version-22-0-0-0/m-p/10335125#M16382</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-05-24T13:10:58Z</dc:date>
    </item>
  </channel>
</rss>

