Register a Syncfusion® license key in a Razor Class Library App

22 Oct 20252 minutes to read

Register the Syncfusion® license key before any Syncfusion® Blazor component is initialized. Place the key in the Razor Class Library (RCL) project so every consuming app inherits the registration.

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

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.

If the RCL references Syncfusion Blazor packages from nuget.org or from the trail installer, register the license key in the RCL before packaging or referencing it. The registration pattern mirrors the approach used in Blazor Apps (server or WebAssembly).

For setup guidance, see Getting started with Syncfusion Blazor in a Razor Class Library.

Blazor Web App

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

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

Blazor Server App

After referencing the RCL from a Blazor Server application, register the license key in Program.cs.

  • For .NET 8 and .NET 9 apps, open ~/Program.cs 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 WebAssembly App

After referencing the RCL from a Blazor WebAssembly application, register the license key in Program.cs.

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

NOTE

Refer to this link for more information on getting started with RCL in the Blazor Server and Blazor Client WebAssembly application.