<?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: Can't load dll file in coreconsole in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/can-t-load-dll-file-in-coreconsole/m-p/11963522#M8828</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should show how you load the DLL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another thing, is the CommandFlags.Session mandatory for the TestCode method?&lt;/P&gt;</description>
    <pubDate>Mon, 15 May 2023 04:38:56 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2023-05-15T04:38:56Z</dc:date>
    <item>
      <title>Can't load dll file in coreconsole</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-t-load-dll-file-in-coreconsole/m-p/11963424#M8827</link>
      <description>&lt;P&gt;I've trying to use accoreconsole.exe to process a batch of files. According to Kean's blog(&lt;A href="https://www.keanw.com/2012/02/the-autocad-2013-core-console.html" target="_blank"&gt;https://www.keanw.com/2012/02/the-autocad-2013-core-console.html&lt;/A&gt;), coreconsole&amp;nbsp;&lt;SPAN&gt;can also load CRX modules and .NET DLLs that have been coded against the new AcCoreMgd.dll (rather than AcMgd.dll). In my code I only used AcDbMgd.dll and AcCoreMgd.dll as references. However, When I tried to load my dll in coreconsole, it showed that "can't load *** assembly".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My accoreconsole.exe version is 2021. And my code structure is as below:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("TEST", CommandFlags.Session)]
        public void TestCode()
        {
            Document acDoc = AcadCore.Application.DocumentManager.CurrentDocument;
            Database acDb = acDoc.Database;

            using (DocumentLock acLock = acDoc.LockDocument())
            {

                using (Transaction acTrans = acDb.TransactionManager.StartTransaction())
                {
                    // Logic code

                    acTrans.Commit();
                }
            }
            acDb.SaveAs(acDoc.Name, true, DwgVersion.Current, acDb.SecurityParameters);
        }&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;Could someone tell me why this is happening? Thanks a lot.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 02:49:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-t-load-dll-file-in-coreconsole/m-p/11963424#M8827</guid>
      <dc:creator>Miralkong</dc:creator>
      <dc:date>2023-05-15T02:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can't load dll file in coreconsole</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-t-load-dll-file-in-coreconsole/m-p/11963522#M8828</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should show how you load the DLL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another thing, is the CommandFlags.Session mandatory for the TestCode method?&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 04:38:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-t-load-dll-file-in-coreconsole/m-p/11963522#M8828</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-05-15T04:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Can't load dll file in coreconsole</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-t-load-dll-file-in-coreconsole/m-p/11963689#M8829</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've tried 2 ways to load the dll file. The first one is to open accoreconsole.exe directly and in the command window enter netload. Then when it asks the dll file path, I enter the full path of the released version. The second way is to start a accoreconsole process and then try to load the dll file using StreamWriter.WriteLine() Method. The main structure is as below:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private bool CoreConsleProcess(string programPath, string dwgFilePath, string scriptPath)
        {
            using (Process myProcess = new Process())
            {
                myProcess.StartInfo.UseShellExecute = false;
                //myProcess.StartInfo.CreateNoWindow = true;
                myProcess.StartInfo.FileName = programPath;
                myProcess.StartInfo.RedirectStandardInput = true;
                myProcess.Start();

                StreamWriter myStreamWriter = myProcess.StandardInput;

                myStreamWriter.WriteLine($"open {dwgFilePath}");

                //myStreamWriter.WriteLine($"script {scriptPath}");

                myStreamWriter.WriteLine(@"netload dll full path");

                myStreamWriter.WriteLine("test");

                //myProcess.WaitForExit();

                myProcess.Close();

            }
            return true;
        }&lt;/LI-CODE&gt;&lt;P&gt;As to the session flag, because I have to save the current database at the end of my code, in my test, if session flag is not assigned, some error is thrown. And I just removed the command session. It can't be loaded neither.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 06:26:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-t-load-dll-file-in-coreconsole/m-p/11963689#M8829</guid>
      <dc:creator>Miralkong</dc:creator>
      <dc:date>2023-05-15T06:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can't load dll file in coreconsole</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-t-load-dll-file-in-coreconsole/m-p/11966444#M8830</link>
      <description>&lt;P&gt;Hi Gilles,&lt;/P&gt;&lt;P&gt;This morning I did more test And I found that If I put the dll file in the directory of which the accoreconsole.exe is in, it can be loaded successfully. I don't know if there is a path length limitation in accoreconsole which causes the problem. But it worked in my case. Thanks again.&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 06:17:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-t-load-dll-file-in-coreconsole/m-p/11966444#M8830</guid>
      <dc:creator>Miralkong</dc:creator>
      <dc:date>2023-05-16T06:17:58Z</dc:date>
    </item>
  </channel>
</rss>

