Yet another update for D365BCAppHelper / Read information from Runtime packages

Allgemein, Business Central, Development, PowerShell , ,

In the last post I introduced you to a new function in the D365BCAppHelper-module – Get-D365BCManifestFromAppFile. I also informed you that it is limited to “regular” App-packages (meaning “non-Runtime-Packages” that weren’t created with Get-NAVAppRuntimePackage). But I also said that I would try to figure out if it is possible to include these as well.

Spoiler alert: it’s possible

Well, I’m not sure how much details you want on this or if I should disclose them right away. Actually I think that any semi-experienced .NET developer with an afternoon of time and some understanding of assembly reflection and similar techniques is able to figure it out. But I also don’t want to disclose it in an overly detailed way, because I’m not sure if there are implications I didn’t think about just yet (also because Microsoft states in the documentation, that Runtime packages can be used to protect intellectual property).

Let’s just say, that the Runtime-packages are also basically just a ZIP-file, but with an separately encoded filestream. I decided to do the decoding with an inline C#-class within the CmdLet only for performance reasons (and this inline class is just a little bit obfuscated to not make it too obvious). When I first tried to adapt the code to PowerShell the execution for one small package took around 7 minutes (!), compared to <1 second with C# (maybe I just don’t understand enough of PowerShells variable-scopes and that’s why it was so slow?, Dunno, to be honest.)

So, what now?

Well, I updated the module again, so that you can now use it for any type of package (app-file). Again: until now I only tested it with App-files for Business Central 13, 14 and 15. But I assume, that it will still work for future versions (would be weird if Microsoft just changes the file format).

Anything else?

Yep, I also updated the existing CmdLets in the meantime (Get-D365BCAppNameFromFile, Get-D365BCPublisherFromFile, Get-D365BCVersionFromFile), so that they’ll work directly on any machine – with or without existing Business Central standard DLLs (NavAdminTool.ps1). If you notice any problems, feel free to contact me (leave a comment or see “Follow Me”-box on the right) or create an issue on GitHub.

Again: I’d love to hear your feedback, comments, etc.. Did this module help anyone else than me? Do you think it’s a waste of time? Whatever it is, feel free to leave your thoughts 😊

P.S.: If anyone is interested in the details of the Runtime-Package-Handling or likes to know more about the approach: I’m happy to answer any question. The little “obfuscation” in the sources is not because I want to protect anything, I just don’t want to carelessly leave anything out in the open – GitHub/the internet does not forget.

Leave a Reply

Your email address will not be published. Required fields are marked *