.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Troubleshooting PackageContents.xml in Autocad 2025

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
sseylerTT9ZJ
1726 Views, 16 Replies

Troubleshooting PackageContents.xml in Autocad 2025

I'm having problems with Autoloading my Plugin in AutoCAD 2025. 

 

It works fine in AutoCAD 2024.

It works fine if I manually use the NETLOAD command in AutoCAD 2025.

 

I did have a SeriesMax of R23.4 in my PackageContents but I removed that parameter.

 

Based on the post Solved: DLL in Plugin Bundle Fail to be Autoloaded I even checked the PackageContents.xml for non-printable characters, but nothing unusual was found.

 

At this point I'm focused on the PackageContents.xml file, but I'm not sure what my next steps should be.

 

Any suggestions?

 

<?xml version="1.0" encoding="UTF-8"?>
<ApplicationPackage SchemaVersion="1.0" 
Name="BlockExtractor" 
AppVersion="2024.2.2.1" 
Description="Block Extractor" 
Author="Steven Seyler" 
ProductCode="{951D58DA-FCD7-4AEC-8453-2DF130AC9FDB}" >
  <CompanyDetails Name="Flex-N-Gate" Url="http://www.flexngate.com" Email="sseyler@flexngate.com" />
  <Components>
    <RuntimeRequirements OS="Win64" SeriesMin="R20.0" />
    <ComponentEntry AppName="BlockExtractor" ModuleName="BlockExtractor.dll" AppDescription="Block Extractor" LoadOnAutoCADStartup="True">
	  <Commands GroupName="FNGAPD">
        <Command Local="Extract" Global="Extract" />
      </Commands>
	
	</ComponentEntry>
  </Components>
</ApplicationPackage>

 

Labels (3)
16 REPLIES 16
Message 2 of 17


@sseylerTT9ZJ wrote:

 

It works fine if I manually use the NETLOAD command in AutoCAD 2025.

 

That would suggest that the issue is in the code that runs at startup (e.g., an IExtensionApplication?). This is an AutoCAD managed runtime design issue that many have been bitten by. It's caused by the fact that AutoCAD's managed runtime conceals/suppresses exceptions in code that automatically executes at startup (e.g., IExtensionApplication.Initialize).

 

The NETLOAD command executes the startup code in the document execution context, whereas if the code is loaded automatically at startup, it runs in the application context. If the startup code is sensitive to the execution context, it often results in this very symptom (e.g., it works with NETLOAD but not when loaded at startup, or visa-verse).

 

What you should do is verify if the code is actually loading at startup, or not.  If it is loading, and there's an exception thrown by any code that runs at startup, the exception will be suppressed/concealed by the AutoCAD managed runtime, (unless you run the code in a handler for the Application.Idle event), Such exceptions will also prevent commands from being defined, making it appear as if the extension was not loaded.

 

Message 3 of 17

No IExtensionApplication, so no IExtensionApplication.Initialize.

 

For testing purposes I added it with stubs for Initialize and Terminate, no change. I've tried adding code to the Initialize to test that it's running at startup, but I'll confess I'm not sure what code should be able to run in ACAD's application context - a simple MessageBox.Show doesn't work but I'm not certain what conclusion to draw from that.

 

My original code:

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.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;

using Microsoft.Office.Interop;

using Autodesk.AutoCAD.Windows;
// using Microsoft.Office.Interop.Excel;

[assembly: CommandClass(typeof(ExtractBlocks.Class1))]

namespace ExtractBlocks
{
    public class Class1
    {
        [CommandMethod("Extract")]
        public static void ExtractBlocks()
    }
}

 

And as it sits right now:

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.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;

using Microsoft.Office.Interop;

using Autodesk.AutoCAD.Windows;
using Microsoft.Office.Interop.Excel;
using System.Windows;
// using Microsoft.Office.Interop.Excel;

[assembly: ExtensionApplication(typeof(ExtractBlocks.HelloWorldApp))]
[assembly: CommandClass(typeof(ExtractBlocks.Class1))]

namespace ExtractBlocks
{

    public class HelloWorldApp : Autodesk.AutoCAD.Runtime.IExtensionApplication
    {
        void IExtensionApplication.Initialize()
        {
            MessageBox.Show("Blockexport Running");
        }

        void IExtensionApplication.Terminate()
        {
        }
    }

    public class Class1
    {
        [CommandMethod("Extract")]
        public static void ExtractBlocks()
    }
}

 

Message 4 of 17

Your ExtractBlocks() method is missing a body, but I don't think that would cause the problem.

 

At this point, what I would do is try to register the assembly for demand-loading via the registry, and see if it loads and defines your commands (you can register it to load at startup, or when one of the command methods it includes is first-issued), by setting LOADCTRLS appropriately:

 

  • 0x01: Load the application upon detection of proxy object.
  • 0x02: Load the application upon AutoCAD startup.
  • 0x04: Load the application upon invocation of a command.
  • 0x08: Load the application upon request by the user or another application.
  • 0x10: Do not load the application.
  • 0x20: Load the application transparently.

 

 

Message 5 of 17

The body was just folded when I copied the code, so it didn't come over.

 

So listing it in the Registry works, even with a LOADCTRLS = 0x0002. That should be the same timing as a bundle file, right?

Message 6 of 17
22951050
in reply to: sseylerTT9ZJ

This issue has occured to me also, so i'm looking forwarding some solution

 

i also removed the versionMax Attribute for Application tag, but it seems not related to this issue.

 

and when execute the autocad 2025,

 

in registry for autocad 2025 loaded key(\HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R25.0\ACAD-8101:409\Loaded)

there is also exist my .bundle subkey, but it does not has its subkeys not like other bundles in same parent key which have the relative path of my .dll file.

 

while it has subkeys like other bundles in R24.3 and the .dll file loaded well

Message 7 of 17

If it works when you register it manually in the registry, then it has to be a problem in AutoCAD, new to 2025.

 

 

Message 8 of 17

While I don't love the outcome, I do greatly appreciate your assistance in getting to it!

 

Thanks @ActivistInvestor !

Message 9 of 17
moogalm
in reply to: sseylerTT9ZJ

You need to provide separate bounds for both AutoCAD 2024 and AutoCAD 2025, as the underlying .NET runtime has changed from .NET 4.x to NET 8.0


<?xml version="1.0" encoding="UTF-8"?>
<ApplicationPackage SchemaVersion="1.0" 
Name="BlockExtractor" 
AppVersion="2024.2.2.1" 
Description="Block Extractor" 
Author="Steven Seyler" 
ProductCode="{951D58DA-FCD7-4AEC-8453-2DF130AC9FDB}" >
  <CompanyDetails Name="Flex-N-Gate" Url="http://www.flexngate.com" Email="sseyler@flexngate.com" />
  <Components>
    <RuntimeRequirements OS="Win64" SeriesMin="R20.0" SeriesMax="R24.3" />
    <ComponentEntry AppName="BlockExtractor" ModuleName="BlockExtractor.dll" AppDescription="Block Extractor" LoadOnAutoCADStartup="True">
	  <Commands GroupName="FNGAPD">
        <Command Local="Extract" Global="Extract" />
      </Commands>
	
	</ComponentEntry>
<RuntimeRequirements OS="Win64" SeriesMin="R25.0" SeriesMax="R25.0" />
    <ComponentEntry AppName="BlockExtractor" ModuleName="BlockExtractor_NET8.0.dll" AppDescription="Block Extractor" LoadOnAutoCADStartup="True">
	  <Commands GroupName="FNGAPD">
        <Command Local="Extract" Global="Extract" />
      </Commands>
	
	</ComponentEntry>
  </Components>
</ApplicationPackage>
Message 10 of 17

Hi @moogalm 

I have tried you solution for xml file but it didn't work for me. Based on Autodesk documentation 

https://help.autodesk.com/view/OARX/2025/ENU/?guid=GUID-3C25E517-8660-4BB7-9447-2310462EF06F

I moved <RuntimeRequirements> inside ComponentEntry and it works.

Can you check it please.

Message 11 of 17

Sorry, you are right, RuntimeRequirements should be at ComponentEntry level in this case.

Message 12 of 17

Message 13 of 17

Message 14 of 17

I also have a bundle that won't load the dll at startup. Of course it will netload, and I have created a registry entry for it. It will autoload that way, but not using the bundle. I have the bundle in program files to avoid the SECURELOAD issue. In the xml below, if I comment out the dll component, the cuix loads. So there's something wrong with the dll component. I've stared at is and researched all I can find. It's probably staring me in the face, but I can't see it. Maybe some fresh eyes can see it?

 

<?xml version="1.0" encoding="utf-8" ?>
<ApplicationPackage
    SchemaVersion="1.0"
    AutodeskProduct="AutoCAD"
    ProductType="Application"
    AppVersion="2022.0.0.1"
    ProductCode="{BCF17CB5-B9E9-4877-BB89-23E74576CE47}"
    UpgradeCode="{0F36311B-4F7D-4F79-9F20-D8060649FDB1}"
    Name="EJ_PageSetupImport"
    Description="Utility for importing page setups into current drawing."
    Author="Ed Jobe"
    Helpfile="./Contents/PageSetupImportHelp.html">
  <CompanyDetails
    Name=""
    URL=""
    Email="">
  </CompanyDetails>
  <Components>
    <ComponentEntry
      AppName="EJ_PageSetupImport_CUIX"
      AppDescription="Menu for EJ_PageSetupImport."
      ModuleName="./Contents/EJ_PageSetupImport.cuix"
	    AppType="CuiX"
      LoadOnAutoCADStartup="True"
      >
    </ComponentEntry>
    <ComponentEntry
      AppName="EJ_PageSetupImport"
      AppDescription="Tools for importing page setups into the current drawing."
      MouduleName="./Contents/EJ_PageSetupImport.dll"
	    AppType=".Net"
      LoadOnAutoCADStartup="True"
      >
      <RuntimeRequirements OS="Win64" Platform="AutoCAD*" SeriesMin="R19.0" SeriesMax="R24.3" SupportPath="./Contents"/>
      <Commands GroupName="EJ_">
        <Command Local="ImportPageSetupsConfig" Global="ImportPageSetupsConfig"/>
        <Command Local="ImportPageSetupND" Global="ImportPageSetupND"/>
      </Commands>
    </ComponentEntry>
  </Components>
</ApplicationPackage>

 

Update: I updated the xml above. I was missing the following keys:
AutodeskProduct="AutoCAD"
ProductType="Application"

 

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 15 of 17
Alexander.Rivilis
in reply to: Ed.Jobe

@Ed.Jobe 

AutoCAD 2025? 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 16 of 17
Ed.Jobe
in reply to: Alexander.Rivilis

No, 2023 and 2024. thanks.

@moogalm  Do you have any insights?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 17 of 17
Ed.Jobe
in reply to: Ed.Jobe

Update: I updated the xml above. I was missing the following keys:
AutodeskProduct="AutoCAD"
ProductType="Application"

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta