Creating Blazor-Based Frontend Plugins for the Battery Test System Web UI
- Updated2024-10-31
- 4 minute(s) read
Creating Blazor-Based Frontend Plugins for the Battery Test System Web UI
Blazor is the main technology for integrators to develop Web UI environments to control and monitor the Battery Test System. Using Blazor, you can develop plugins that fully customize the appearance and functionality of the Web UI to suit your application.
To use Blazor-based Web UI plugins, you must install the following software in your development environment:
- .NET 6.0.2 (SDK 6.0.200) or newer
- Battery Test System Web Server 2022 or newer
To create Blazor-based Web UI plugins, you should have competence in the following development technologies:
- Blazor
- ASP .NET Core
- C#/.NET
Additionally, NI recommends that you be familiar with the following technologies:
- FluentUI: a library of UI components
- Bulma: a CSS framework for user interfaces
To use Blazor-based plugins, you first need to install a project template. You can then develop the individual plugins. You need to install the project template on a system once; you can then create as many plugins as you need.
Complete the following steps to add a Blazor-based plugin to your Web UI environment. If you are creating a Blazor-based plugin for the first time, start from the beginning; if you have already completed first-time setup, skip to Blazor-Based Plugin Creation.
-
Open a command prompt and install the project template for Blazor-based plugins
with the following command:
dotnet new --install "C:\Program Files\National Instruments\Battery Test System\PluginTemplates\BatteryTestUIPlugins.ProjectTemplates.1.0.0.nupkg"
-
Verify that everything has installed correctly by running the following
command:
dotnet new --list --tag BatteryTestYour installation was successful if you receive the following message:

- In the command prompt, change the directory to the folder that will contain the source code for your Blazor-based plugins.
-
Create a page plugin project by running the following command:
dotnet new batterytest-uiplugins --name <Plugin Name> --output <Plugin Folder Name>
A new directory with the Plugin Folder Name you specify is created in your current directory, and a new Plugin Name.csproj file, along with supporting files, is created within the new directory.
The default plugin that is created modifies the home page of the Web UI to implement a basic counter.
-
Modify the plugin to suit your application. For plugin pages, consider editing
the customizable settings in the specific PageItem class,
for example, HomePageItem class. For plugin components,
consider customizing the name given to your plugin in the
AddCustomComponentPlugins function in the
PluginServiceRegistrar class.
Refer to Property Reference for Battery Test System Web UI Web Page Host Plugins for more information about customizing the properties.
-
Build the new plugin project to generate a .dll, which the
Web UI uses to incorporate the plugin.
- Command prompt: Change the directory to the folder that contains the plugin and use dotnet build to build Plugin Name.csproj. Refer to Microsoft documentation on dotnet build for options.
- VisualStudio: Open Plugin Name.csproj and build with .
-
For the BTS Server for Windows, do the following:
- (Windows) Create a folder named for the plugin you implemented in the following location: %Public%\Public Documents\National Instruments\Battery Test System\WebApplication\Web UI Plugins\Plugin Folder Name.
- Consider if you need to remove any existing plugins from %Public%\Public Documents\National Instruments\Battery Test System\WebApplication\Web UI Plugins. For instance, if your new plugin is for a new Home page, you can choose to remove any existing home page plugin dll.
- (Windows) Copy the plugin's .dll(s) and Resources folder, if applicable, into this new folder.
- (Windows) Restart the BTS Web UI service by opening the Windows Services Manager, selecting NI Battery Test System Web Server, and clicking Restart the service.
-
For the BTS Server with SystemLink Enterprise, do the following:
-
Zip all of the plugins into a zip file.
Do not place the plugins in any nested folders when zipping. Individual plugin folders must be present directly at the root itself once zipped.
In the following example, the BTS Server can only discover plugins in the correct case. In the incorrect case, the BTS Server cannot discover either plugin.
Correct Incorrect Plugin.zip Plugin-1 (Plugin-1 files) Plugin-2 (Plugin-2 files)Plugin.zip SomeIntermediateFolder Plugin-1 (Plugin-1 files) SomeOtherIntermediateFolder Plugin-2 (Plugin-2 files) - Upload the zip file to any storage which supports downloading a file using a URL.
- Specify the URL and the authentication information in the pluginDownloader section of the helm chart file.
-
Zip all of the plugins into a zip file.
- Verify that the new plugin appears correctly by viewing the Web UI URL in your browser. If there are errors loading your page, the browser's console window might show the errors. If there are errors loading your page, the browser's console window might show the errors.
Related Information
- Property Reference for Battery Test System Web UI Web Page Host Plugins
To fully implement web page host plugins for the Battery Test System Web UI, you need to customize the page or component plugin settings.