When working with multiple AL extensions with dependencies in a Visual Studio Code workspace, during the development phase it’s quite common to have the need to deploy a given project. Currently, however, if the NST server doesn’t have all the extensions that the project depends on, these dependencies must be manually traversed and installed, because dependency publishing only works if there’s a baseline to calculate from.
The new AL language extension version 9.x (that comes with Dynamics 365 Business Central 2022 Wave 1 release) introduces a new feature for working with workspace and dependencies. If you have an app that depends from other apps, you can now directly deploy this given app and the deployment process will traverse a project dependency graph in the workspace and install any required projects if these aren’t already deployed to the NST server.
How does it work?
Let’s consider the following scenario. I have a Visual Studio Code workspace with 5 apps with dependencies like in the following schema:
As you can see, I have 5 apps where:
- BASE has no dependencies
- APP1 and APP2 depends from BASE
- APP3 depends from APP1
- APP4 depends from APP2 and APP3
I have all these 5 apps loaded into a Visual Studio Code workspace and I’m currently working on APP4:
On my sandbox environment, I’ve actually no apps installed.
In the past, if I want to test APP4 I need first to install all the needed dependencies on the sandbox environment by manually traversing the dependency tree, otherwise APP4 cannot be installed (error on missing dependencies).
Now, I can select the APP4 project and I can start the following command from the Visual Studio Code command palette:
AL: Publish full dependency tree for active project is a new command available in the AL language extension 9.x. When starting this new command from APP4, Visual Studio Code traverses all the dependency tree, starting from the current project and going to all the projects loaded into the workspace.
What happens here is that the full dependency tree is automatically discovered and published on my sandbox environment:
If I check the Extension Management page, this is what I have now:
All my extensions are automatically published in the right order, directly from a single command.
I think that this new small feature can help a lot during the development phase…
NOTE: the new command will only handle project and app references included into the workspace. If the deployed AL project has dependencies to apps that aren’t included in the workspace, these will still have to be present in the sandbox or manually deployed in advance.