It’s been some time since my last post. Mostly because I didn’t have a good topic to post about (I was mostly pre-occupied with getting my first experiences upgrading a BC14 database with CSIDE to a BC15 database).
Recently I had a requirement where I needed to read the metadata information from an app-File on a machine where I didn’t have the standard CmdLets available (e.g.
Get-NAVAppInfo). Normally, if you want to get this information (e.g. the AppId) you’d use something like the following (example from Microsoft Docs):
Get-NAVAppInfo -Path '.\Proseware SmartApp.app'
which will return something like this:
Id : 3c88160c-e0eb-4fe1-b4f6-011e45d74b10 Name : Proseware SmartApp Version : 184.108.40.2060 Publisher : Proseware, Inc. Brief : First Proseware App Description : First NAV App by Proseware Compatibility Id : 220.127.116.11 Privacy Statement : http://www.proseware.com/SmartApp/privacypolicy.aspx EULA : http://www.proseware.com/SmartApp/ULA.aspx Help : http://www.proseware.com/SmartApp/Support.aspx Url : http://www.proseware.com/SmartApp/ Logo : SmartLogo.png ScreenShots : SmartShot1.png, SmartShot2.png, SmartShot3.png Capabilities : Prerequisites : Dependencies :
But you can’t do this, if Business Central is not installed on this machine (specifically if Microsoft.Dynamics.Nav.Apps.Management-module is missing). So I decided to check if there was another way.
I already knew that App-Files are basically ZIP-files, since you can open them with tools like 7Zip or WinRAR (like described here by Luc). Sadly, you can not just use the
Expand-Archive CmdLet from PowerShell or the
ZipArchive-class via C# (in System.IO.Compression), because you’ll receive an exception like the following:
Expand-Archive : .app is not a supported archive file format. .zip is the only supported archive file format.
If you rename the file to .zip it still won’t work. Similar like you can’t open the file with the Windows-integrated archive viewer in Explorer. But since it works with 7Zip or other tools, there has to be a way.
After some investigation the reason was pretty obvious and easy to resolve. App-Files contain a 40-byte header, so the “normal” ZIP-file starts with a 40-byte offset in the App-file.
To give you all an easy access to this, directly via PowerShell, I update my module D365BCAppHelper with a new CmdLet
Get-D365BCManifestFromAppFile. This CmdLet gets the NavxManifest.xml file from the App (see screenshot) and returns the content of the Package-node as an Xml-object
Following I’ll give an example of the usage.
$xmlManifest = Get-D365BCManifestFromAppFile -Filename "F:\temp\15\PayPalPaymentsStandard.app" $xmlManifest.App
The output will look something like this
Id : d09fa965-9a2a-424d-b704-69f3b54ed0ce Name : PayPal Payments Standard Publisher : Microsoft Brief : PayPal Payments Standard adds a PayPal link to your sales documents so customers can easily pay using PayPal. From inside Dynamics 365 Business Central; you can send the documents by email to provide higher customer service and shorten the time it takes for customersï¿½ payments to arrive on your bank account. Description : Customers continuously require higher levels of service, both in terms of the quality of product, but also in terms of delivery and payment services. PayPal Payments Standard adds a PayPal link to your sales documents so customers can easily pay using PayPal. You can send the documents by email to provide higher customer service and shorten the time it takes for customer payments to arrive in your bank account. This extension can embed a link to PayPal on all invoices automatically, or a user can do it on individual invoices. The PayPal Payments Standard extension gives customers more ways to pay invoices because PayPal offers multiple ways of handling payments, including credit card processing, PayPal accounts, and other sources. Plus, PayPal delivers a trustworthy payment service, which customers prefer to entering credit card information on unknown websites, and PayPal does not require monthly fees or setup fees. Because this functionality is built as an extension, it gives you full control to enable it when and if your business processes require it. Version : 15.2.39040.0 CompatibilityId : 0.0.0.0 PrivacyStatement : https://go.microsoft.com/fwlink/?LinkId=724009 EULA : https://go.microsoft.com/fwlink/?linkid=2009120 Help : https://go.microsoft.com/fwlink/?LinkId=733363 HelpBaseUrl : Url : https://go.microsoft.com/fwlink/?LinkId=724011 Logo : /logo/ExtensionLogo.png Platform : 18.104.22.168 Runtime : 4.2 Target : OnPrem ShowMyCode : False
Of course you can not only access the “App” node, but also the other nodes (like “IdRanges” or “Dependencies”).
Right now it’s not possible to get this information from Runtime-packages (created with
Get-NavAppRuntimePackage). I’m looking into it, if it’s possible to do this. Microsoft states that these packages a somehow protected, but what is a weekend without a challenge, right? 😉
Remarks / Tests
Until now I tested the scripts with App-Files from Business Central 13, 14 and 15 and it worked fine. I’ll check it with further files in the future.
Where to get it?
If you already have have the module D365BCAppHelper installed, you need to update it to version 0.0.0.15
Update-Module -Name D365BCAppHelper -Force
If you didn’t already install it, just do it via the following line
Install-Module -Name D365BCAppHelper
After importing it via
Import-Module -Name D365BCAppHelper you are ready to go 😊
If you like to contribute to it, check out the repository on Github. If you notice any problems, feel free to create an issue. And if you just like to leave a “Thanks” or have any questions use the comments on this page 😊