Business Central Musings

For the things we have to learn before we can do them, we learn by doing them

What is Rapid Application Development; a closer look at rad.json

Share This Post

Who has not noticed a rad.json file during development or in the source code management blade in VS Code?

I did, and I got curious on what is affecting this file.

“RAD” comes from rapid application development and is a feature Microsoft introduced recently.

When you work with larger projects, packaging the project and deploying it with Publish or Publish with Debugging or without Debugging, can take a long time.

Rapid application development concept was created to help alleviate the time spent deploying the extension during development phase.

The compiler is looking at what’s been changed since last build and deployment and generates a rad.json file in the .vscode folder, where it keeps track of what objects have been changed and the type of the change: was it added, modified or removed. And with these 2 commands in VS Code we can deploy just the changes included in rad.json:

Working with Rad.json

Let’s look at a simple example. Start with a Hello World project.

  1. Publish the project with only the HellowWorld.al file
  1. Notice how the rad.json has no content for any of the arrays: Added, Modified or Removed.

2. Add an AL file, for example, add a table “Table1.al”. Package the project (CTRL + SHIFT + B). The rad.json file will reflect this addition:

Note: If you don’t like the one liner format of rad.json
{"Added":[{"Id":50150,"Kind":10,"Name":"MyTable","PackagePath":"/src/Table1.al"}],"Modified":[],"Removed":[]}
you can use VS code’ Format Document SHIFT + ALT + F to display the json in a format similar to the one in the picture above.

3. Let’s modify the HellowWorld.al file, save and build. Looking at rad.json we can see now both files marked for rad (rapid application development) deployment:

4. Let’s push the code to the sandbox. We could push it with Publish with Debug, Publish without Debug or using the two new rapid application development specific AL commands:

  • AL: Rapid Application Publish with debugging
  • AL: Rapid application Publish without debugging
What these two actions will do is sending a limited set of your app file content to the sandbox, just the executables for the 2 objects mentioned in the rad.json changes: Table1.al and HelloWorld.al.

As soon as the project gets published successfully to the sandbox, the list of changes in rad.json is cleared:

You can publish the project with Publish with or without Debugging, the rad.json gets emptied anyways.

Don’t hijack rad.json

The rad.json is maintained within the same VS code session. If, for example you publish, make a change to a file, save and close VS code the rad.json file does not get modified. You need to build (CTRL+SHIFT+B) to keep track of changes in the code since last build.

So if you really want to hijack rad.json, you would do something similar to my test:

  • make a change to a file: Changed message “Hello World4” to “Hello World5” in “Hello World.al”
  • save the change
  • don’t build
  • close VS Code
  • open VS Code
  • modify another file: e.g. add another field in Table1.
  • save project
  • build
  • Notice rad.json contains the modification in Table1.al
  • Do “AL Rapid Application Developemnt with Debug” or without debug

You can notice that the first change, done prior to closing VS code is not published because it still shows “Hello World4”.

Not all file changes affect rad.json

Report layout files (rdl, rdlc and docx)

Creating a new report and assigning a rdlc or docx layout does not trigger an update for rad.json.

Translation files (xlf)

Turn on translation files in app.json, build, observe the creation of a Translations folder and a xlf file, but also note the fact that rad.json stays unchanged.

Permission files (xml)

From the VS Code command palette, trigger “AL: Generate permission set as xml file containing current set of objects”; then build. Note how rad.json stays unchanged.

However, when generating an AL permission set file, we can notice it in the rad.json file.

Web service definitions

Create a new xml file in your project and run snippet twebservice. Build and observe how rad.json remains unchanged.

Conclusions

Rad.json is useful when working on larger projects if you want to save time with the deployment during development.

First, we saw what changes are logged in rad.json; Rad.json will capture changes in AL files between builds; once extension is published either with a rapid publishing or full publishing, rad.json is cleared.

Then, we noticed that some project files changes, especially xml files, won’t affect the content of rad.json, as these are normally packaged during regular publishing.

The final state of an application must be built using full publishing and never with RAD publishing.

Check out Microsoft document on Rapid Application Development: Work with Rapid Application Development – Business Central | Microsoft Learn.

Share This Post

Related Articles

One Response

Leave a Reply

Recent Posts

Get Notified About New Posts

Categories

Discover more from Business Central Musings

Subscribe now to keep reading and get access to the full archive.

Continue reading

Verified by MonsterInsights