Display Configuration Generator is a standalone tool which uses HMI file to generate Nextion Display class in which you have references to:
  • Fonts
  • Images
  • Pages
  • Components

Using this class you can access Nextion Display components using strongly typed objects. Tool is included in the driver package and required .NET 4.0 to run.
Using visual studio build event's you can always have your class up-to-date.



You can run tool from command line every time you change you HMI file or you can use Visual Studio build events in project configuration to make VS updates you class file every time you build your project.


Parameter Description Default Value
First parameter Path to HMI file Parameter is required
/ns Class namespace JernejK.NextionNET
/cn Class name DisplayConfiguration
/o Output file DisplayConfiguration.generated.cs

  • DisplayConfigurationGenerator.exe ..\HMI\Demo.hmi
  • DisplayConfigurationGenerator.exe ..\HMI\Demo.hmi /ns MyNamespace /cn NextionClass



HMI file

Demo HMI file in Nextion Editor

Generated class example

Generated file

Example code

var display = new NextionDisplay(new System.IO.Ports.SerialPort("COM2", 9600));
display.PageId = DisplayConfiguration.Page0.Id;
DisplayConfiguration.Page0.t0.Text = "Test123";
DisplayConfiguration.Page0.p0.PictureId = (int)DisplayConfiguration.Pictures.Picture0_4C5C9ED1;

display.TouchEvent += (sender, e) =>
    var ctrl = e.ResolveControl();
    if (ctrl == DisplayConfiguration.Page0.b0)
        Debug.Print("Button click");

Visual Studio Build Event

Using VS build event you can always have updated class file. Here is an example configuration:

Visual Studio Build Event

Last edited Nov 13, 2015 at 7:45 PM by jernejk, version 3