If you have Visual Studio, you can use ILDASM.EXE and ILASM.EXE to do the disassembly and reassembly. From a Visual Studio command prompt:
image.png
launch the ildasm tool and open the DLL file (make a backup copy in case you make a mistake or it doesn’t work for some reason):
From the file menu, select Dump’, use the default settings and save the file:
Depending on how the original DLL was built, you may end up with a single .il file, or a .il file and one or more .res files.
You can open the files with a text editor. You then search for the text of your menus, and you will find code like this for each menu item:
Change the first string to have the menu structure you want, using double backslashes to separate them:
Once you have changed them all, you use ILASM.EXE from the developer command prompt to reassemble the code.
E:\SOLIDWORKS Files>ilasm /DLL CustomPropertyCleaner.il
===========================================================
Microsoft (R) .NET Framework IL Assembler. Version 4.8.3761.0
Copyright (c) Microsoft Corporation. All rights reserved.
Assembling 'CustomPropertyCleaner.il' to DLL --> 'CustomPropertyCleaner.dll'
Source file is UTF-8
...
...
...
...
Class 89
Method Implementations (total): 2
Resolving local member refs: 0 -> 0 defs, 0 refs, 0 unresolved
Writing PE file
Operation completed successfully
E:\SOLIDWORKS Files>
If there were one or more .res files, you have to include them as well, so the command would be:
E:\SOLIDWORKS Files>ilasm /DLL /RES=res1.res /RES=res2.res /CustomPropertyCleaner.il
Once this is done, you should have a new DLL file. The tricky part is getting the new DLL into the system and it depends on how your add-in was originally installed. If the vendor just gave you a DLL file and instructions, you should be able to remove the existing add-in DLL and reload the modified DLL using the vendor’s instructions.
If it works, you should see your new menu structure, like this:
Also, this will only work for .NET DLL files. If the add-in was written in plain C++, none of this will work. All my tests were done using a C# DLL.