Dynamics 365 Business Central: How to build extension (Package/Publish) without generating report layout files??? – (“al.compilationOptions” -> “generateReportLayout”)

Dynamics 365 Business Central

Hi, Readers.
Today I would like to share a mini tip of Business Central, how to build extension (Package/Publish) without generating report layout files in VS Code.

When we create a new report, there are two main tasks to consider. First, we define the report dataset of data items and columns. Then, we design the report layout.

For example, I create a new report, and set the following layout properties. (You can use new rendering section, more details: Link)

Now, press Ctrl+Shift+P, and then choose AL: Package. The StandardSalesOrderConf.rdlc and StandardSalesOrderConf.docx will be generated.

Okay, it’s the default action, and there’s nothing wrong with that. So what is the problem?

BC Developers who use Azure DevOps or Github may notice that when you develop a project that includes the layout file of the Report object, the modified time of the layout file may be different from the Repositories in the cloud. Why?
Because even if your layout file hasn’t changed, when you package the project, the modified time of the layout file will still be updated in the local, but since there are no changes, there is no need to upload to the Repositories.
Test Video:

How to avoid this? In fact, we can build extension (Package/Publish) without generating report layout files.

Open User or Workspace settings and find the associated settings:

Change the following settings to false.

“generateReportLayout”: Controls whether the compiler will generate Report Layout files when building the package.

    "al.compilationOptions": {
        "generateReportLayout": false,

Let’s test it again.

1. If the report layout is not generated in your project, you need to check this setting.

2. If you encounter the following error, please set “generateReportLayout” to True.

Processing of message ‘al/createPackage’ failed with error: ‘Could not find file ‘c:\Users\yzhu\Documents\AL\ReportLayoutTest\MyExcelContactList.xlsx’.’Details:System.IO.FileNotFoundException: Could not find file ‘c:\Users\yzhu\Documents\AL\ReportLayoutTest\MyExcelContactList.xlsx’.File name: ‘c:\Users\yzhu\Documents\AL\ReportLayoutTest\MyExcelContactList.xlsx’   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)


Hope this will help.

Thanks for your reading.