Skip to main content

Resources

Resources are static files embedded in the AOT and deployed as part of the application model. They provide a way to include non-code files — XML templates, Excel workbooks, images, HTML pages, CSS stylesheets, JavaScript files, certificates, and other binary or text content — in the source-controlled codebase.

When a resource is added to a model, it is version-controlled alongside the X++ code and metadata. At runtime, the resource can be loaded by name from the resource store and used by X++ code.


When to Use Resources

Resources are the correct mechanism whenever you need to:

  • Include XML templates — e.g., Electronic Reporting configuration templates, data import schemas, or fixed-format document templates.
  • Bundle Excel workbooks — e.g., templates for Excel-based report generation, data migration templates.
  • Store images or icons — e.g., custom images for forms, reports, or workspaces.
  • Include HTML/CSS/JavaScript — e.g., custom workspace tiles, embedded web content, or Power BI report definitions.
  • Store certificates — e.g., SSL certificates for service authentication.
  • Embed PCF controls — Power Apps Component Framework controls packaged as resources.

Resource Types

Each resource is categorised by a TypeOfResource enum value:

ValueNameDescription
0ImagesImage files (PNG, JPG, BMP, GIF, ICO)
1AudioAudio files
2VideoVideo files
3DataGeneric data files (XML, JSON, Excel, CSV, etc.)
4PublishCSSCSS stylesheets for publishing
5OnlineHelpCSSCSS stylesheets for online help
7ToolbarCSSCSS stylesheets for toolbars
9XmlDocXML documentation files
10HtmlHTML pages
11ScriptsJavaScript files
12StylesCSS style files
13TextPlain text files
14CertificateCertificate files
15PowerBIReportPower BI report PBIX files
16PCFControlPower Apps Component Framework controls

Adding a Resource

In Visual Studio

  1. Right-click your project → AddNew ItemResourcesResource.
  2. Enter the resource Name (this is the AOT identifier used in code).
  3. Set the TypeOfResource to the appropriate category.
  4. Use FileName to reference the physical file.
  5. Import the file content.

Using Resources in Code

Loading a Resource

Using a Resource as an Excel Template

Using a Resource as an XML Configuration