Syncfusion License Key Validation in CI Services
13 Jul 20268 minutes to read
Syncfusion license key validation in CI services ensures that Syncfusion Essential Studio components are properly licensed during CI processes. Validating the license key at the CI level can prevent licensing errors during deployment. Set up the continuous integration process to fail when the license key validation fails by surfacing a non-zero exit code from the validation script.
The following sections show how to validate the Syncfusion license key in CI services.
-
Download and extract the
LicenseKeyValidator.ziputility from the following link: LicenseKeyValidator. Extract the contents to a known location, for exampleD:\LicenseKeyValidator. -
Open the
LicenseKeyValidation.ps1PowerShell script in a text or code editor, as shown in the example below.
# Replace the parameters with the desired platform, version, and actual license key.
$result = & $PSScriptRoot"\LicenseKeyValidatorConsole.exe" /platform:"UIComponent" /version:"34.1.29" /licensekey:"Your License Key"
Write-Host $result# Replace the parameters with the desired platform, version, and actual license key.
$result = & $PSScriptRoot"\LicenseKeyValidatorConsole.exe" /platform:"WindowsForms" /version:"26.2.4" /licensekey:"Your License Key"
Write-Host $result-
Update the parameters in the script:
Platform: Set /platform:”UIComponent” for v34.1.29 and later, or /platform:”WindowsForms” for earlier versions (use the relevant Syncfusion platform as needed).
Version: Change the value for
/version:to the required version (e.g.,"26.2.4").License Key: Replace the value for
/licensekey:with your actual license key (e.g.,"YOUR LICENSE KEY").NOTE
This feature is supported from version 16.2.0.41 of Essential Studio and later.
Azure Pipelines
YAML
-
Create a new User-defined Variable named
LICENSE_VALIDATIONin the Azure Pipeline. Use the path of theLicenseKeyValidation.ps1script file as the value (e.g.,D:\LicenseKeyValidator\LicenseKeyValidation.ps1). -
Add the PowerShell task to the pipeline to execute the script and validate the license key.
The following example shows the syntax for Windows build agents.
pool:
vmImage: 'windows-latest'
steps:
- task: PowerShell@2
inputs:
targetType: filePath
filePath: $(LICENSE_VALIDATION) #Or the actual path to the LicenseKeyValidation.ps1 script.
displayName: Syncfusion License ValidationAzure Pipelines (Classic)
-
Create a new User-defined Variable named
LICENSE_VALIDATIONin the Azure Pipeline. Use the path of theLicenseKeyValidation.ps1script file as the value (e.g.,D:\LicenseKeyValidator\LicenseKeyValidation.ps1). -
Add the PowerShell task to the pipeline to execute the script and validate the license key.

GitHub Actions
- To execute the script in PowerShell as part of a GitHub Actions workflow, add a step in the configuration file and update the path of the
LicenseKeyValidation.ps1script file (e.g.,D:\LicenseKeyValidator\LicenseKeyValidation.ps1).
The following example shows the syntax for validating the Syncfusion license key in GitHub Actions.
steps:
- name: Syncfusion License Validation
shell: pwsh
run: |
./path/LicenseKeyValidator/LicenseKeyValidation.ps1Jenkins
-
Create an Environment Variable named
LICENSE_VALIDATION. Use the path of theLicenseKeyValidation.ps1script file as the value (e.g.,D:\LicenseKeyValidator\LicenseKeyValidation.ps1). -
Add a stage in the Jenkins pipeline to execute the
LicenseKeyValidation.ps1script in PowerShell. On Windows agents, use thebatstep (theshstep is for Linux/Unix agents).
The following example shows the syntax for validating the Syncfusion license key in the Jenkins pipeline.
pipeline {
agent any
environment {
LICENSE_VALIDATION = 'path\\to\\LicenseKeyValidator\\LicenseKeyValidation.ps1'
}
stages {
stage('Syncfusion License Validation') {
steps {
sh 'pwsh ${LICENSE_VALIDATION}'
}
}
}
}Validate the License Key By Using the ValidateLicense() Method
-
Register the license key properly by calling RegisterLicense(“License Key”) method with the license key.
-
Once the license key is registered, it can be validated by using the
ValidateLicense(Platform.WindowsForms)method. This ensures that the license key is valid for the platform and version you are using. Refer to the following example.
using Syncfusion.Licensing;
// Register the Syncfusion license key
SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
//Validate the registered license key.
// The array overload allows validating against multiple platforms in a single call.
bool isValid = SyncfusionLicenseProvider.ValidateLicense(new[] { Platform.UIComponent });using Syncfusion.Licensing;
// Register the Syncfusion license key
SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
// Validate the registered license key
bool isValid = SyncfusionLicenseProvider.ValidateLicense(Platform.WindowsForms);NOTE
Use
Platform.UIComponentfor UI component license validation in v34.1.29 and later.Platform.WindowsFormsis not supported from v34.1.29 onwards.
-
If the ValidateLicense() method returns true, registered license key is valid and can proceed with deployment.
-
If the ValidateLicense() method returns false, there will be invalid license errors in deployment due to either an invalid license key or an incorrect assembly or package version that is referenced in the project. Please ensure that all the referenced Syncfusion assemblies or NuGet packages are all on the same version as the license key’s version before deployment.
Validate the License Key By Using the Unit Test Project
- To create a unit test project in Visual Studio, choose File -> New -> Project from the menu. This opens a dialog for creating a new project. Filter the project type by Test, or type Test as a keyword in the search box, to find the available unit test project templates. Select the test framework (such as MSTest, NUnit, or xUnit) that best suits your needs.

-
For more details on creating unit test projects in Visual Studio, refer to the Getting Started with Unit Testing guide.
-
Add a reference (or NuGet package) for
Syncfusion.Licensingto the test project, and register the license key by calling theRegisterLicense("YOUR LICENSE KEY")method in the test project’s setup.
NOTE
- Place the license key between double quotes (e.g.,
RegisterLicense("YOUR LICENSE KEY")). Ensure thatSyncfusion.Licensing.dllis referenced in the project where the license key is being registered.
-
Once the license key is registered, it can be validated by using the ValidateLicense(“Platform.WindowsForms”, out var validationMessage) method. This ensures that the license key is valid for the platform and version you are using.
-
Refer to the following example, which demonstrates how to register and validate the license key in the unit test project.
public void TestSyncfusionWindowsFormsLicense()
{
var platform = Platform.WindowsForms;
// Register the Syncfusion license key
SyncfusionLicenseProvider.RegisterLicense("Your License Key");
bool isValidLicense = SyncfusionLicenseProvider.ValidateLicense(platform, out var validationMessage);
Assert.That(isValidLicense, Is.True, $"Validation failed for {platform}." + $" Validation Message: {validationMessage}");
// Log validation messages to TestContext output
if (isValidLicense)
{
TestContext.Out.WriteLine($"Platform {platform} is correctly licensed for version " + $"{typeof(SyncfusionLicenseProvider).Assembly.GetName().Version}");
}
}- Once the unit test is executed, if the license key validation passes for the specified platform, the output similar to the following will be displayed in the Test Explorer window.

- If the license validation fails during unit testing, the following output will be displayed in the Test Explorer window.

Troubleshooting
License validation fails due to either an invalid license key or an incorrect assembly or package version referenced in the project. In such cases:
- Verify that you are using a valid license key for the platform.
- Ensure that the assembly or package versions referenced in the project match the version of the license key.
- Confirm that
Syncfusion.Licensing.dll(or theSyncfusion.LicensingNuGet package) is referenced in the project.