Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge license-fail-2885 into production #2888

Merged
merged 9 commits into from
Apr 2, 2025
Merged
24 changes: 22 additions & 2 deletions deployment/ci-cd-license-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ The Telerik license activation process in CI/CD environments involves the follow

1. Go to the [License Keys page](https://www.telerik.com/account/your-licenses/license-keys) in your Telerik account and download your license key.
1. Set an environment variable with either of the following names:
* `TELERIK_LICENSE`—the value must be the Telerik license key string.
* `TELERIK_LICENSE_PATH`—the value must be the full path to the license key file, including the license file name itself. `TELERIK_LICENSE_PATH` requires `Telerik.Licensing` version `1.4.9` and above. You can use it with Telerik UI for Blazor `8.1.0` and above.
* `TELERIK_LICENSE`—the value must be the Telerik license key string.
* `TELERIK_LICENSE_PATH`—the value must be the full path to the license key file, including the license file name itself. `TELERIK_LICENSE_PATH` requires `Telerik.Licensing` version `1.4.9` and above. You can use it with Telerik UI for Blazor `8.1.0` and above.
1. (optional) [Fail the build and deployment](#abort-deployment-on-license-key-error) if there is an issue with the license key.

In most cases, the recommended way to provide your license key to the `Telerik.Licensing` NuGet package in CI/CD environments is to use the `TELERIK_LICENSE` environment variable.

Expand Down Expand Up @@ -129,6 +130,25 @@ Also see [Using NuGet Keys](slug:deployment-nuget#using-nuget-keys) in the artic
dotnet publish BlazorProjectName.csproj -c Release -o /app/publish /p:UseAppHost=false
````

## Abort Deployment on License Key Error

To avoid accidental [license watermarks and notifications on your live site](slug:installation-license-key#will-telerik-ui-for-blazor-work-with-an-expired-license-key), you can fail the application build and abort deployment when there is an issue with the license key. There are two alternative ways to list the [Telerik license warning codes](slug:troubleshooting-license-key-errors#error-messages) to be treated as errors:

* [Add a `<WarningsAsErrors>` tag](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/errors-warnings#warningsaserrors-and-warningsnotaserrors) to the `.csproj` project file:
````XML.skip-repl
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<WarningsAsErrors>TKL001;TKL002;TKL003;TKL004;TKL101;TKL102;TKL103;TKL104;TKL105</WarningsAsErrors>
</PropertyGroup>
````

* [Set the `-warnaserror` MSBuild switch](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-command-line-reference?view=vs-2022#switches) in the [`dotnet build` command](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build#msbuild):
````SH.skip-repl
dotnet build -warnaserror:"TKL001;TKL002;TKL003;TKL004;TKL101;TKL102;TKL103;TKL104;TKL105"
````

## Next Steps

* [Restore Telerik NuGet Packages in CI/CD Workflows](slug:deployment-nuget)
Expand Down
2 changes: 2 additions & 0 deletions installation/license-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ Scenarios that do not match the above three descriptions result in the following
* A watermark appears on Telerik UI for Blazor components.
* [A warning message appears in the application's build log](slug:troubleshooting-license-key-errors).

To avoid accidental license watermarks and notifications on your live site, you can [fail the application build and abort deployment](slug:deployment-license-key#abort-deployment-on-license-key-error) when there is an issue with the license key.

### I updated Telerik UI for Blazor in my app and got license errors. Why?

The most likely cause is that the new Telerik UI for Blazor version was released after the expiration date of your current license or license key. To fix this issue:
Expand Down