|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: Overview of Syncfusion license validation in CI services - Syncfusion |
| 4 | +description: Learn here about how to register Syncfusion license key for Syncfusion application for license validation. |
| 5 | +platform: Blazor |
| 6 | +component: Common |
| 7 | +documentation: ug |
| 8 | +--- |
| 9 | + |
| 10 | +<style> |
| 11 | +#license { |
| 12 | + font-size: .88em!important; |
| 13 | +margin-top: 1.5em; margin-bottom: 1.5em; |
| 14 | + background-color: #fbefca; |
| 15 | + padding: 10px 17px 14px |
| 16 | +} |
| 17 | +</style> |
| 18 | + |
| 19 | + |
| 20 | +# Syncfusion license key validation in CI services |
| 21 | + |
| 22 | +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. The following section shows how to validate the Syncfusion license key in CI services. |
| 23 | + |
| 24 | +* Download and extract the LicenseKeyValidator.zip utility from the following link: [LicenseKeyValidator](https://s3.amazonaws.com/files2.syncfusion.com/Installs/LicenseKeyValidation/LicenseKeyValidator.zip). |
| 25 | + |
| 26 | +* Open the LicenseKeyValidation.ps1 PowerShell script in a text\code editor. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +* Update the parameters in the LicenseKeyValidation.ps1 script file as described below. |
| 31 | + |
| 32 | + **Platform:** Modify the value for /platform: to the actual platform "Blazor". |
| 33 | + |
| 34 | + **Version:** Change the value for /version: to the required version (e.g., "26.2.4"). |
| 35 | + |
| 36 | + **License Key:** Replace the value for /licensekey: with your actual license key (e.g., "Your License Key"). |
| 37 | + |
| 38 | +## Azure Pipelines (YAML) |
| 39 | + |
| 40 | +* Create a new [User-defined Variable](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#user-defined-variables) named `LICENSE_VALIDATION` in Azure Pipeline. Use the path of the LicenseKeyValidation.ps1 script file as a value (e.g., D:\LicenseKeyValidator\LicenseKeyValidation.ps1). |
| 41 | + |
| 42 | +* Integrate the PowerShell task in pipeline and execute the script to validate the license key. |
| 43 | + |
| 44 | +The following example shows the syntax for Windows build agents. |
| 45 | + |
| 46 | +```bash |
| 47 | +pool: |
| 48 | + vmImage: 'windows-latest' |
| 49 | + |
| 50 | +steps: |
| 51 | + |
| 52 | +- task: PowerShell@2 |
| 53 | + inputs: |
| 54 | + targetType: filePath |
| 55 | + filePath: $(LICENSE_VALIDATION) #Or the actual path to the LicenseKeyValidation.ps1 script. |
| 56 | + |
| 57 | + displayName: Syncfusion License Validation |
| 58 | +``` |
| 59 | + |
| 60 | +## Azure Pipelines (Classic) |
| 61 | + |
| 62 | +* Create a new [User-defined Variable](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#user-defined-variables) named `LICENSE_VALIDATION` in Azure Pipeline. Use the path of the LicenseKeyValidation.ps1 script file as a value (e.g., D:\LicenseKeyValidator\LicenseKeyValidation.ps1). |
| 63 | + |
| 64 | +* Include the PowerShell task in pipeline and execute the script to validate the license key. |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +## GitHub actions |
| 69 | + |
| 70 | +* To execute the script in PowerShell as part of a GitHub Actions workflow, include a step in the configuration file and update the path of the LicenseKeyValidation.ps1 script file (e.g., D:\LicenseKeyValidator\LicenseKeyValidation.ps1). |
| 71 | + |
| 72 | +The following example shows the syntax for validating Syncfusion license key in GitHub actions. |
| 73 | + |
| 74 | +```bash |
| 75 | + steps: |
| 76 | + - name: Syncfusion License Validation |
| 77 | + shell: pwsh |
| 78 | + run: | |
| 79 | + ./path/LicenseKeyValidator/LicenseKeyValidation.ps1 |
| 80 | +``` |
| 81 | + |
| 82 | +## Jenkins |
| 83 | + |
| 84 | +* Create a [Environment Variable](https://www.jenkins.io/doc/pipeline/tour/environment) named 'LICENSE_VALIDATION'. Use Use the path of the LicenseKeyValidation.ps1 script file as a value (e.g., D:\LicenseKeyValidator\LicenseKeyValidation.ps1). |
| 85 | + |
| 86 | +* Include a stage in Jenkins to execute the LicenseKeyValidation.ps1 script in PowerShell. |
| 87 | + |
| 88 | +The following example shows the syntax for validating Syncfusion license key in Jenkins pipeline. |
| 89 | + |
| 90 | +```bash |
| 91 | +pipeline { |
| 92 | + agent any |
| 93 | + environment { |
| 94 | + LICENSE_VALIDATION = 'path\\to\\LicenseKeyValidator\\LicenseKeyValidation.ps1' |
| 95 | + } |
| 96 | + stages { |
| 97 | + stage('Syncfusion License Validation') { |
| 98 | + steps { |
| 99 | + sh 'pwsh ${LICENSE_VALIDATION}' |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +## Validate the License Key Using ValidateLicense() Method |
| 107 | + |
| 108 | +* Register the license key properly by calling RegisterLicense("License Key") method with the license key. |
| 109 | + |
| 110 | +* Once the license key is registered, it can be validated by using ValidateLicense("Platform.Blazor") method. This ensures that the license key is valid for the platform and version you are using. For reference please check the following example. |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +* If ValidateLicense() method returns true, registered license key is valid and can proceed with deployment. |
| 115 | + |
| 116 | +* If 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. |
| 117 | + |
0 commit comments