Distribute the Created Reports with the Application

This topic describes how to distribute reports with an application and update them.


This topic is related to the legacy Reports Module (Obsolete). If you use the Reports V2 Module, you do not need to follow the instructions here. Instead, create a predefined report as described in the Create Predefined Static Reports topic.

  • Create the EmbeddedReports folder in the MySolution.Module project:


  • Run the Windows Forms application.
  • Export each report layout to an REPX file in the new EmbeddedReports folder using the Report Designer's smart tag menu.


  • Stop the application. In the Solution Explorer, click the Show All Files toolbar button. Select the report files in the EmbeddedReports sub-folder, right-click the selection, and choose Include in Project.


  • Set the Build Action property for both REPX files to Embedded Resource.


  • Add the following references to the application module:




  • Open the Updater.cs (Updater.vb) file located in the MySolution.Module project and add the following method to the Updater class:

    using DevExpress.ExpressApp.Reports;
    using DevExpress.ExpressApp;
    private void CreateReport(string reportName) {
       ReportData reportdata = ObjectSpace.FindObject<ReportData>(
          new BinaryOperator("Name", reportName));
       if (reportdata == null) {
          reportdata = ObjectSpace.CreateObject<ReportData>();
          XafReport rep = new XafReport();
          rep.ObjectSpace = ObjectSpace;
             "MySolution.Module.EmbeddedReports." + reportName + ".repx"));
          rep.ReportName = reportName;

    In this method, a new ReportData object is created (the report that you created via the Report Designer in the Create a Report in Visual Studio lesson). The content of the report from the EmbeddedReports folder, passed as a parameter, is saved to this ReportData object, which is then saved to the database.


    The LoadLayout method loads the report's definition saved within the report file. This definition includes the report name. We set the ReportName property after loading the report definition to avoid creating duplicate reports. Otherwise, duplicate reports may appear when the name stored within the report definition differs from the name passed to the CreateReport method.

  • To create reports and save them to the database, the CreateReport method defined in the previous step must be called from the Updater's UpdateDatabaseAfterUpdateSchema method. For this purpose, execute the CreateReport method for each report you wish to create in the UpdateDatabaseAfterUpdateSchema method as shown below:

    public class Updater : DevExpress.ExpressApp.Updating.ModuleUpdater {
       public override void UpdateDatabaseAfterUpdateSchema() {
  • Check to see that the reports are created when running the application.


See Also