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:
| Value | Name | Description |
|---|---|---|
| 0 | Images | Image files (PNG, JPG, BMP, GIF, ICO) |
| 1 | Audio | Audio files |
| 2 | Video | Video files |
| 3 | Data | Generic data files (XML, JSON, Excel, CSV, etc.) |
| 4 | PublishCSS | CSS stylesheets for publishing |
| 5 | OnlineHelpCSS | CSS stylesheets for online help |
| 7 | ToolbarCSS | CSS stylesheets for toolbars |
| 9 | XmlDoc | XML documentation files |
| 10 | Html | HTML pages |
| 11 | Scripts | JavaScript files |
| 12 | Styles | CSS style files |
| 13 | Text | Plain text files |
| 14 | Certificate | Certificate files |
| 15 | PowerBIReport | Power BI report PBIX files |
| 16 | PCFControl | Power Apps Component Framework controls |
Adding a Resource
In Visual Studio
- Right-click your project → Add → New Item → Resources → Resource.
- Enter the resource Name (this is the AOT identifier used in code).
- Set the TypeOfResource to the appropriate category.
- Use FileName to reference the physical file.
- Import the file content.