Here’s the process to combine an NT assembly with 1 or more third party assemblies using Agile.net.
First you need to know which options are used by AgileDotNet when it does its magic behind the scenes. To do that, launch AgileDotNet GUI from the Windows Start menu under Secure Team.
The default settings for the inline process reside in this file: C:\Program Files\NinjaTrader 8\bin\Custom\Backup\AgileDotNet.cls
From GUI > Open Project and point it to the above file. Make sure not to make any changes to this file and leave it as is.
Click through all the tabs in the GUI and note which options are set. You’ll see that the only option used is the “Code Encryption”. None of the other security features are enabled.
I don’t want to open another can of worms here and this is probably a topic for a whole another conversation, but it’s worth noting that this limited security could be somewhat concerning. The String Obfuscation option would have been really good to have. Especially if you have embedded string passwords in your code. If String Obfuscation isn’t enabled, these strings can be extracted from the DLL which is a major security concern with passwords/URLs/etc. But enabling any other options aside from the Code Encryption option, seems to generate an assembly that doesn’t import cleanly on the 3rd party system and causes all sorts of other issues. I’ll let you experiment with the various options on your own, but most likely you’ll reach the same conclusion. Just keep in mind that, if you have embedded password or other sensitive information in your code, be aware that they can be extracted from the DLL by potential hackers so try to avoid doing this or find an alternate solution.
Going back to the original process …
I assume that by now you already have your 3rd party assemblies incorporated into NT and added them as References in NinjaScript editor, so I won’t get into that.
Next step: Tools > Export > NinjaScript Add-on
Check the checkbox for Export as compiled assembly
Uncheck the box for Protect compiled assembly (protection comes later and is done manually)
If you leave protection on in this stage, the Build process later will have issues so make sure this is unchecked.
Include all your scripts and add the 3rd party assemblies as References.
Export
You’ll get a warning that says something to the effect that the other system will need to have the 3rd party assembly installed for your assembly to work. This is fine, just accept this and proceed.
The zip file that is created will contain the NT assembly and a file called Reference (or something similar). This Reference file can be removed and isn’t needed.
Copy the DLL file from the zip into a temporary folder on your system.
Copy your 3rd party assembly DLL file/files into the same folder.
Launch AgileDotNet GUI
Input Tab: Add all your assemblies, your main one should be the first entry.
Code Encryption tab: Check all assemblies
Make sure all other options on other tabs are disabled (same as the default NT one)
Merging tab: Select your main assembly as Primary Assembly and check the checkboxes for all the ones in the panel below.
Press the Build button.
You can save all of your settings/etc as a project file by going to Save Project. You can reopen this file at a later time if you want to update your assembly. It will have all your options and same DLL files loaded. Saves a good chunk of time if you’re going to do this frequently.
If all goes well, this will give you your secured combined assembly.
Remove the original DLL from the zip file and replace it with the secured one.
Remove the Reference file (or whatever it’s called).
Make sure you leave the original .cs and info.xml files intact.
The final zip file should include only the following three items:
info.xml
YourPackage.cs
YourPackage.dll
Import this on a 3rd system and test.
Hope this helps.