Guidelines for Partners: How to Extract BC 365 Base App using artifacts

Modestas Dulevičius

Project Manager

Topic: Technical

Date: 18 Mar 2022

Probably most of you already know that with the Dynamics 365 Business Central 2019 Wave 2 release, we have the ability to modify the Base App. But to extract Dynamics 365 Business Central Base App as .al files that would compile might be quite difficult. As you have probably noticed, picture/image functionality on Docker is becoming outdated in Business Central 365 latest releases. Instead, we can use artifacts that are pretty similar to the previously used images. In this article, we will talk about how to extract the Dynamics 365 Business Central Base App using Docker and artifacts.

 

If you want to extract Dynamics 365 Business Central Base App, you need to have Docker installed on your machine and a bit of Windows PowerShell knowledge. For more information on how to use Docker and the basics of AL, you can check out a blog post “Tips and tricks on how to start using Dynamics 365 Business Central Docker.”

 

To begin with, using artifacts is slightly easier than using images because you do not need to look for the exact picture names for each Business Central 365 version, cumulative update, or localization. All these 3 parameters can be specified in the artifact description, so docker will automatically find the required Base app version and download it from Microsoft servers.

 

To begin with, run Windows PowerShell as Administrator, because it will be used for Docker commands. Using PowerShell we have to define some parameters, such as credentials, valid Business Central 365 license path and others:

$credential = New-Object pscredential ‘admin’, (ConvertTo-SecureString -String ‘admin’ -AsPlainText -Force)

$additionalParameters = @(‘–network=external’)

$licenseFilePath = “C:\temp\BC19.flf”

 

The last parameter will be an artifact. To define an artifact, we must specify the localization and Business Central version. For example, I would like to get a Base app which is BC 19 version, cumulative update 2 with Danish localization. The artifact definition should look as follow:

$artifactUrl = Get-BcArtifactUrl -type OnPrem -country dk -version “19.2”

 

 

If the artifact version is invalid, you will get an error during a container creation. When all required parameters are already defined, we can use command to create a BC container:

New-BCContainer -accept_eula -containerName “BaseApp19” -artifactUrl $artifactUrl -Credential $credential -auth NavUserPassword -includeAL -licensefile $licenseFilePath -updateHosts

 

When the container is created you should see the following information:

 

Once the Base App container is created, use the command below to extract Base App objects into the project folder (specify -alProjectFolder parameter the path you want Base App objects to be created in):

Create-AlProjectFolderFromBCContainer -containerName “BaseApp19” -alProjectFolder “C:\temp\BaseApp19” -useBaseLine -useBaseAppProperties.

 

 

That’s it – The Base Application has been extracted!

 

I would like to mention some steps for the extracted Base App if you want to build it for the first time:

  1. As you have probably noticed, there are not any standard libraries in .netPackages folder of the Base App project. When creating a Base App project, all library (.dll) files are stored in the local machine where your docker container is installed, e.g: C:\ProgramData\BcContainerHelper\Extensions\BaseApp19\.netPackages
    If you want to build the Base App from another computer, you have to copy all (.dll) files from the container folder to the project’s .netPackages folder.
  2. You have to create a service tier for the Base App project, then publish/sync/install System.app and Microsoft_System Application.app as these apps are required for the Base App to build.
  3. Modify/Create app.json and launch.json files in the Base App project. Setup them to work with your environment and previously created service tier. Download symbols, when everything is prepared.
  4. Build the project. 🙂

 


 

All in all, using artifacts and images there is the only way to setup a Base App as a project because by using other ways you will not be able to extract all components required to build the application. I would suggest using artifacts over images because the usage is quite straightforward and images can become obsolete in the upcoming Business Central versions.

Related Posts
Read latest industry tips and news in our blog