<?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 Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025 in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13053839#M2462</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using openxml to read and write excel files in an AutoCAD plugin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recently switched from AutoCAD 2024 to AutoCAD 2025 and I'm migrating the project to .NET8.&lt;/P&gt;&lt;P&gt;The project itself has no issues. It successfully compiles.&lt;/P&gt;&lt;P&gt;But I'm unable to load the&amp;nbsp;&lt;STRONG&gt;DocumentFormat.OpenXml.dll&lt;/STRONG&gt; into AutoCAD 2025. I'm getting the below error.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Command: NETLOAD
Cannot load assembly. Error details: System.IO.FileLoadException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=3.1.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17'.
   at System.Runtime.Loader.AssemblyLoadContext.&amp;lt;LoadFromPath&amp;gt;g____PInvoke|5_0(IntPtr __ptrNativeAssemblyBinder_native, UInt16* __ilPath_native, UInt16* __niPath_native, ObjectHandleOnStack __retAssembly_native)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
   at Autodesk.AutoCAD.ApplicationServices.ExtensionLoader.Load(String fileName)
   at loadmgd()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can load the "&lt;STRONG&gt;DocumentFormat.OpenXml.Framework.dll&lt;/STRONG&gt;" into 2025 but not the first one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can load both the&amp;nbsp; dlls into AutoCAD 2024 without issues.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing something ?&amp;nbsp;Could any one please help?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 30 Sep 2024 05:40:53 GMT</pubDate>
    <dc:creator>shricharana_bharadwaj</dc:creator>
    <dc:date>2024-09-30T05:40:53Z</dc:date>
    <item>
      <title>Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13053839#M2462</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using openxml to read and write excel files in an AutoCAD plugin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recently switched from AutoCAD 2024 to AutoCAD 2025 and I'm migrating the project to .NET8.&lt;/P&gt;&lt;P&gt;The project itself has no issues. It successfully compiles.&lt;/P&gt;&lt;P&gt;But I'm unable to load the&amp;nbsp;&lt;STRONG&gt;DocumentFormat.OpenXml.dll&lt;/STRONG&gt; into AutoCAD 2025. I'm getting the below error.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Command: NETLOAD
Cannot load assembly. Error details: System.IO.FileLoadException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=3.1.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17'.
   at System.Runtime.Loader.AssemblyLoadContext.&amp;lt;LoadFromPath&amp;gt;g____PInvoke|5_0(IntPtr __ptrNativeAssemblyBinder_native, UInt16* __ilPath_native, UInt16* __niPath_native, ObjectHandleOnStack __retAssembly_native)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
   at Autodesk.AutoCAD.ApplicationServices.ExtensionLoader.Load(String fileName)
   at loadmgd()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can load the "&lt;STRONG&gt;DocumentFormat.OpenXml.Framework.dll&lt;/STRONG&gt;" into 2025 but not the first one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can load both the&amp;nbsp; dlls into AutoCAD 2024 without issues.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing something ?&amp;nbsp;Could any one please help?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 05:40:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13053839#M2462</guid>
      <dc:creator>shricharana_bharadwaj</dc:creator>
      <dc:date>2024-09-30T05:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13055279#M2463</link>
      <description>&lt;P&gt;Later versions of AutoCAD comes with a version of DocumentFormat.OpenXml.dll. So, you should tell how you set reference to it: you use the one coming with AutoCAD, or use NuGet package (thus the latest version)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The one coming with AutoCAD does not have DocumentFormat.OpenXml.Framework.dll, which is a required dependency if you use the latest version of DocumentFormat.OpenXml.dll from NuGet package.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since we are doing Acad2025/.NET 8.0, we should always use NuGet package for the latest version of it and make sure all the dependency DLLs in the NuGet package are deployment with the AutoCAD plugin DLL. So, you need to look into your plugin DLL folder where you NETLOAD it from: do all the DLLs coming with the NuGet package be there?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure you have properly edited the Plugin's *.projcs file, as shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="normanyuan_0-1727712490508.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1416135iC99C88D895142B98/image-size/medium?v=v2&amp;amp;px=400" role="button" title="normanyuan_0-1727712490508.png" alt="normanyuan_0-1727712490508.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did a quick test with following code, which refers an enum type in DocumentFormat.OpenXml.dll. It works OK, meaning the DocumentFormat.OpenXml.dll is loaded into AutoCAD 2025 correctly.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("OpenXmlTest")]
        public static void RunMyCommand()
        {
            var dwg = CadApp.DocumentManager.MdiActiveDocument;
            var ed = dwg.Editor;

            var obj = DocumentFormat.OpenXml.PresentationDocumentType.Presentation;

            ed.WriteMessage($"\nOpenXml.PresentationDocumentType: {obj}");
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;I added reference from NuGet package, which is in its version 3.10, as opposed to version 2.16, the one comes with AutoCAD2024/2025.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 16:15:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13055279#M2463</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-09-30T16:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13056346#M2464</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have the CopyLocalLockFileAssemblies set to true is .csproj.&lt;/P&gt;&lt;P&gt;I'm using the latest NuGet packet. The versions are 3.1.0 for both the&amp;nbsp;DocumentFormat.OpenXml.dll and&amp;nbsp;DocumentFormat.OpenXml.Framework.dll.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried loading the 2.16.0 version that comes with AutoCAD 2025, it loads without issue. But when I try to load the 3.1.0 version file it gives the above mentioned error and does not load the dll.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have these two dlls in the plugin folder.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shricharana_bharadwaj_0-1727760946994.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1416292i416B6D51ED3A50EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="shricharana_bharadwaj_0-1727760946994.png" alt="shricharana_bharadwaj_0-1727760946994.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this an AutoCAD bug? Would re-installing AutoCAD work?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 05:36:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13056346#M2464</guid>
      <dc:creator>shricharana_bharadwaj</dc:creator>
      <dc:date>2024-10-01T05:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13057295#M2465</link>
      <description>&lt;P&gt;As I replied previously, the simple code I tested runs OK.&amp;nbsp; Just to prove both DocumentFormat.OpenXml.dll and DocumentFormat.OpenXml.Framework.dll are loaded with my simple plugin, I did minor update to let the code refer 2 enum tyles, one from DocumentFormat.OpenXml.dll and the other from DocumentFormat.OpenXml.Framework.dll and the code run as expected:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;using DocumentFormat.OpenXml;

[assembly: CommandClass(typeof(DocumentOpenXmlTest.MyCommands))]
[assembly: ExtensionApplication(typeof(DocumentOpenXmlTest.MyCommands))]

namespace DocumentOpenXmlTest
{
    public class MyCommands : IExtensionApplication
    {
        [CommandMethod("OpenXmlTest")]
        public static void RunMyCommand()
        {
            var dwg = CadApp.DocumentManager.MdiActiveDocument;
            var ed = dwg.Editor;

            // enum type "PresentationDocumentType" from DocumentFormat.OpenXml.dll
            var obj = DocumentFormat.OpenXml.PresentationDocumentType.Presentation;
            // enum type "FileFormatVersions" from DocumentFormat.OpenXml.Framework.dll
            var fileVersion = FileFormatVersions.Office2016;

            ed.WriteMessage($"\nOpenXml.PresentationDocumentType: {obj}");
            ed.WriteMessage($"\nOpenXml.FileFormatVersion: {fileVersion}");
        }

        public void Initialize()
        {
            var dwg = CadApp.DocumentManager.MdiActiveDocument;
            if (dwg!=null)
            {
                dwg.Editor.WriteMessage("\nOpenXml Test project loaded.");
            }
        }

        public void Terminate()
        {
        
        }
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;I'll take the simple test plugin to one of my other computer for a test (maybe later today) and post back.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 14:04:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13057295#M2465</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-10-01T14:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13061353#M2466</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not saying it's not loading for you. Forgive me if my reply came across that way.&lt;/P&gt;&lt;P&gt;I believe you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the&amp;nbsp;DocumentFormat.OpenXml.dll is not loading in my AutoCAD 2025. I don't know why. All I'm trying to do is get it to load somehow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have so far,&amp;nbsp;&lt;/P&gt;&lt;P&gt;DocumentFormat.OpenXml.dll (version 3.1.0) is &lt;STRONG&gt;not&lt;/STRONG&gt; loading for me and in one of my colleague's laptop running AutoCAD &lt;STRONG&gt;2025&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;DocumentFormat.OpenXml.Framework.dll (version 3.1.0) &lt;STRONG&gt;is&lt;/STRONG&gt; loading without issue in AutoCAD &lt;STRONG&gt;2025&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;DocumentFormat.OpenXml.dll (Version 2.16) that comes with AutoCAD &lt;STRONG&gt;is&lt;/STRONG&gt; loading without issue in AutoCAD &lt;STRONG&gt;2025&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;DocumentFormat.OpenXml.dll (version 3.1.0) &lt;STRONG&gt;is&lt;/STRONG&gt; loading without issue in AutoCAD &lt;STRONG&gt;2024&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's only with version 3.1.0 I'm having an issue with and I'm not sure why!&lt;/P&gt;&lt;P&gt;I'm not sure if it's a corrupt installation or a setting in AutoCAD that's causing this issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anything I can try to get it loaded would be helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2024 04:31:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13061353#M2466</guid>
      <dc:creator>shricharana_bharadwaj</dc:creator>
      <dc:date>2024-10-03T04:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13065325#M2467</link>
      <description>&lt;P&gt;FYI:&lt;/P&gt;
&lt;P&gt;I have test my simple DocumentFormat.OpenXml project in my other computers with AutoCAD 2025 and AutoCAD Civil3d 2025, and it worked as expected. That is, there is no issue of loading lasted version of DocumentFormat.OpenXml.dll and DocumentFormat.OpenXml.Frametwork.dll from NuGet (v3.1.0).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 16:28:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13065325#M2467</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-10-04T16:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13068571#M2468</link>
      <description>&lt;P&gt;Thank you for checking it on your end.&lt;/P&gt;&lt;P&gt;But,&amp;nbsp;I'm still not able to load the dll into AutoCAD 2025. At this point I have no idea what I can try to fix this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 07:14:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13068571#M2468</guid>
      <dc:creator>shricharana_bharadwaj</dc:creator>
      <dc:date>2024-10-07T07:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13074272#M2469</link>
      <description>&lt;P&gt;So,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried loading the dll on a new laptop and freshly installed AutoCAD 2025. The dll still refuses to load.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the acad.exe details&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shricharana_bharadwaj_0-1728484292675.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1419621i1866A71220DD2B22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="shricharana_bharadwaj_0-1728484292675.png" alt="shricharana_bharadwaj_0-1728484292675.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 14:33:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13074272#M2469</guid>
      <dc:creator>shricharana_bharadwaj</dc:creator>
      <dc:date>2024-10-09T14:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to load DocumentFormat.OpenXml.dll into AutoCAD 2025</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13074416#M2470</link>
      <description>&lt;P&gt;The 2 computers I tried my code with Document.Format.OpenXml successfully both have Acad2025.1 update installed when the code was tried:&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="normanyuan_0-1728487879435.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1419654iB31FD3AAC865C55F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="normanyuan_0-1728487879435.png" alt="normanyuan_0-1728487879435.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 15:31:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-load-documentformat-openxml-dll-into-autocad-2025/m-p/13074416#M2470</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-10-09T15:31:47Z</dc:date>
    </item>
  </channel>
</rss>

