Register a Syncfusion® license key in a Blazor application

17 Jul 20264 minutes to read

Register the Syncfusion® license key before any Syncfusion® Blazor component is initialized when referencing packages from NuGet.org or using the trial installer. The license key is a string that must be registered at application startup.

Registering a single license key

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

Registering multiple license keys

You can register multiple license keys using either a comma (,) or a semicolon (;) as the separator between keys.

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY_1,YOUR LICENSE KEY_2,...");

or

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY_1;YOUR LICENSE KEY_2;...");

NOTE

  • Place the license key between double quotes. Also, ensure that Syncfusion.Licensing.dll is referenced in your project where the license key is being registered.
  • Syncfusion® license validation is done offline during application execution and does not require internet access. Apps registered with a Syncfusion® license key can be deployed on any system that does not have an internet connection.

IMPORTANT

Syncfusion® license keys can be validated during the Continuous Integration (CI) processes to ensure proper licensing and prevent licensing errors during deployment. Refer to the CI License Validation section for detailed instructions on how to implement it.

Use the following table to determine where to register the license key based on the Blazor hosting model.

Blazor mode Projects to register the license key Files to register the license key
Blazor Web App (Interactive Auto) Server and client Server/Program.cs, Client/Program.cs
Blazor Web App (Interactive Server) Server Server/Program.cs
Blazor Web App (Interactive WASM) Server and client Server/Program.cs, Client/Program.cs
Blazor Standalone WebAssembly App Client Program.cs

Blazor Web App (Interactive Auto)

Open the ~/Program.cs file in both the server and client projects of a Blazor Web App (Interactive Auto) and register the Syncfusion® Blazor license key.

// Register the Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

Blazor Web App (Interactive Server)

  • For .NET 8, .NET 9, and .NET 10, open the ~/Program.cs file and register the Syncfusion® license key.
var app = builder.Build();
// Register the Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

Blazor Web App (Interactive WebAssembly)

Open the ~/Program.cs file in both the server and client projects of a Blazor Web App (Interactive WebAssembly) and register the Syncfusion® Blazor license key.

// Register the Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

Blazor Standalone WebAssembly App

Open the ~/Program.cs file and register the Syncfusion® Blazor license key in the client web app.

// Register the Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

var builder = WebAssemblyHostBuilder.CreateDefault(args);

....
....