<?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: CLR detected invalid Program in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8167303#M25209</link>
    <description>&lt;P&gt;To be able to use the AutoCAD NET API, you have to build a class library project which generates a DLL that can be NETLOADed from AutoCAD.&lt;/P&gt;
&lt;P&gt;You can start from here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-BA686431-C8BF-49F2-946E-9CEB2F7AE4FA" target="_blank"&gt;http://help.autodesk.com/view/OARX/2018/FRA/?guid=GUID-BA686431-C8BF-49F2-946E-9CEB2F7AE4FA&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jul 2018 11:44:15 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2018-07-31T11:44:15Z</dc:date>
    <item>
      <title>CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8164292#M25202</link>
      <description>&lt;P&gt;I am creating(new to auto CAD) a .net application for Auto CAD (&lt;STRONG&gt;.net 2017 Framework 4.7, Auto CAD 2017&lt;/STRONG&gt;). I have downloaded "&lt;STRONG&gt;Autodesk_ObjectARX_2019_Win_64_and_32_Bit&lt;/STRONG&gt;" and i am using in the application. I have imported the following dll's "&lt;STRONG&gt;using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Runtime;&lt;/STRONG&gt;"). I get the &lt;STRONG&gt;error&lt;/STRONG&gt; "&lt;STRONG&gt;System.InvalidProgramException: CLR detected an Invalid Exception&lt;/STRONG&gt;". I am trying to run the example project "&lt;STRONG&gt;&lt;A href="http://adndevblog.typepad.com/autocad/2012/05/insert-block-from-a-different-dwg-using-net-.html" target="_blank"&gt;http://adndevblog.typepad.com/autocad/2012/05/insert-block-from-a-different-dwg-using-net-.html&lt;/A&gt;&lt;/STRONG&gt;".&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am basically trying to copy files from different .dwg to new .dwg where we can list all the block in the drop down from existing and on selection i can add into the new one.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 09:27:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8164292#M25202</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-30T09:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8164486#M25203</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are targeting AutoCAD 2017, you should reference the 2017 version of ObjectARX libraries.&lt;/P&gt;
&lt;P&gt;You can have a look at &lt;A href="http://gilecad.azurewebsites.net/AutoCAD_VisualStudio.aspx" target="_blank"&gt;&amp;gt;&amp;gt;this table&amp;lt;&amp;lt;&lt;/A&gt; to see compatibilites between AutoCAD, Visual studio and .NET Framework&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 11:13:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8164486#M25203</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-07-30T11:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8164524#M25204</link>
      <description>&lt;P&gt;Thank you for the table i had seen this table but was able to get the link for 2019. Can you provide me the link for 2017.&lt;/P&gt;&lt;P&gt;&lt;A href="http://download.autodesk.com/esd/objectarx/2019/Autodesk_ObjectARX_2019_Win_64_and_32_Bit.sfx.exe" target="_blank" rel="nofollow noopener noreferrer"&gt;http://download.autodesk.com/esd/objectarx/2019/Autodesk_ObjectARX_2019_Win_64_and_32_Bit.sfx.exe&lt;/A&gt;&amp;nbsp;(Same like this)&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;Saravanan.R&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 11:37:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8164524#M25204</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-30T11:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8166622#M25205</link>
      <description>&lt;P&gt;Can any one give a link for downloading "&lt;FONT size="4"&gt;ObjectARX SDK&lt;SPAN&gt;&amp;nbsp;2017"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 04:55:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8166622#M25205</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-31T04:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8166644#M25206</link>
      <description>&lt;P&gt;&lt;A href="https://www.autodesk.com/developer-network/platform-technologies/autocad/objectarx-license-download" target="_blank"&gt;https://www.autodesk.com/developer-network/platform-technologies/autocad/objectarx-license-download&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 05:15:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8166644#M25206</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-07-31T05:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8166671#M25207</link>
      <description>&lt;P&gt;Thank you. I already got the link from same place but why do we have to give all personal information? Hope its not circulated to others.&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;STRONG&gt;I agree to the use of my personal information as described in the&amp;nbsp;&lt;A href="http://www.autodesk.com/privacy" target="_blank"&gt;Autodesk Privacy Statement&lt;/A&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try the new ARX 2017. Will this solve my issue of "&lt;STRONG&gt;System.InvalidProgramException: CLR detected an Invalid Exception"&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 05:41:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8166671#M25207</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-31T05:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8167228#M25208</link>
      <description>&lt;P&gt;I have installed ARX2017 and referenced the DLL. I get this error "&lt;STRONG&gt;System.IO.FileNotFoundException: 'Could not load file or assembly 'accoremgd, Version=21.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;I am doing a windows form and calling the method in class.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Class file:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;[CommandMethod("InsertBlock")]&lt;BR /&gt;public void InsertBlk() // This method can have any name&lt;BR /&gt;{&lt;BR /&gt;Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;using (Database OpenDb = new Database(false, true))&lt;BR /&gt;{&lt;BR /&gt;OpenDb.ReadDwgFile(@"C:\CAD-Reference\INTERNALGA.dwg", System.IO.FileShare.ReadWrite, true, "");&lt;BR /&gt;ObjectIdCollection ids = new ObjectIdCollection();&lt;/P&gt;&lt;P&gt;using (Transaction tr = OpenDb.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;//For example, Get the block by name "TEST"&lt;BR /&gt;BlockTable bt;&lt;BR /&gt;bt = (BlockTable)tr.GetObject(OpenDb.BlockTableId, OpenMode.ForRead);&lt;/P&gt;&lt;P&gt;if (bt.Has("DM_24V_20A_021"))&lt;BR /&gt;{&lt;BR /&gt;ids.Add(bt["DM_24V_20A_021"]);&lt;BR /&gt;}&lt;BR /&gt;tr.Commit();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//if found, add the block&lt;BR /&gt;if (ids.Count != 0)&lt;BR /&gt;{&lt;BR /&gt;//get the current drawing database&lt;BR /&gt;Database destdb = doc.Database;&lt;BR /&gt;IdMapping iMap = new IdMapping();&lt;BR /&gt;destdb.WblockCloneObjects(ids, destdb.BlockTableId, iMap, DuplicateRecordCloning.Ignore, false);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Forms code:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;private void btnInsert_Click(object sender, EventArgs e)&lt;BR /&gt;{&lt;BR /&gt;//PF.CreateAutoCADObject();&lt;BR /&gt;First_Test.PublicStaticClass.ImportExisting FPS = new PublicStaticClass.ImportExisting();&lt;/P&gt;&lt;P&gt;FPS.InsertBlk();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In some post I saw that the code cannot be executed from forms it has to be imported into auto CAD through NETLOAD and then give the CommandMethod. is it correct?&lt;/P&gt;&lt;P&gt;If I want to debug the code and check how do i do it?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 11:17:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8167228#M25208</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-31T11:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8167303#M25209</link>
      <description>&lt;P&gt;To be able to use the AutoCAD NET API, you have to build a class library project which generates a DLL that can be NETLOADed from AutoCAD.&lt;/P&gt;
&lt;P&gt;You can start from here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-BA686431-C8BF-49F2-946E-9CEB2F7AE4FA" target="_blank"&gt;http://help.autodesk.com/view/OARX/2018/FRA/?guid=GUID-BA686431-C8BF-49F2-946E-9CEB2F7AE4FA&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 11:44:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8167303#M25209</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-07-31T11:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8167533#M25210</link>
      <description>&lt;P&gt;Adding to what Gilles has said...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you said "&lt;SPAN&gt;In some post I saw that the code cannot be executed from forms..." is not very clear: the .AutoCAD .NET API can or cannot be executed, is not because of "from form" or not; it is because of being executed within the AutoCAD process or not. So, by saying "from form", if you mean being executed in a stand-alone EXE process (be it Win Form EXE, or console exe, or a service EXE...) then, yes, you cannot use AutoCAD .NET API directly. I'd bet this is the reason you got your error when you tried to run your code, which is an EXE app.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 13:14:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8167533#M25210</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2018-07-31T13:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8170001#M25211</link>
      <description>&lt;P&gt;Thank you for the response.&lt;/P&gt;&lt;P&gt;As per the above I understood from other post that it can be run through the dll only.&lt;/P&gt;&lt;P&gt;I would like to have a application where there is a user form (Windows form) takes input from user like:&lt;/P&gt;&lt;P&gt;* fetch a specific block from a .dwg and place in new .dwg in specific location.&lt;/P&gt;&lt;P&gt;* I told specific location as number of items may be placed in different location.&lt;/P&gt;&lt;P&gt;* In short from the BOM(Bill of material) need find object and place in new .dwg in specific location.&lt;/P&gt;&lt;P&gt;* I would like to debug the code when executing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Saravanan.R&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 11:12:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8170001#M25211</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-01T11:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: CLR detected invalid Program</title>
      <link>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8170146#M25212</link>
      <description>&lt;P&gt;You can use modal or modeless dialog boxes from your DLL to get user inputs.&lt;/P&gt;
&lt;P&gt;To display the forms from an AutoCAD plugin, use the &lt;A href="http://adndevblog.typepad.com/autocad/2012/06/displaying-modal-and-modeless-forms-in-autocad-net.html" target="_blank"&gt;Application.ShowModalDialog() and Application.ShowModelessDialog() methods&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;You can find examples in &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;'s blog as &lt;A href="http://drive-cad-with-code.blogspot.com/2014/02/showing-and-closing-modeless-formdialog.html" target="_blank"&gt;this one&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;If you can read French, I also try to write a 'tutorial' about AutoCAD user interfaces &lt;A href="http://gilecad.azurewebsites.net/UserInterfaces.aspx" target="_blank" rel="nofollow noopener noreferrer"&gt;&amp;gt;&amp;gt;here&amp;lt;&amp;lt;&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 12:06:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clr-detected-invalid-program/m-p/8170146#M25212</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-08-01T12:06:00Z</dc:date>
    </item>
  </channel>
</rss>

