|
| 1 | +--- |
| 2 | +title: Activate your Telerik License with an Assembly (.dll) |
| 3 | +description: Create an Assembly containing your License Key that can be added to the bin folder of Web site projects to activate the Telerik License. |
| 4 | +type: how-to |
| 5 | +page_title: Activate your Telerik License with an Assembly (.dll) |
| 6 | +slug: common-activate-telerik-license-with-assembly |
| 7 | +tags: activate,telerik,license,assembly,dll,class library |
| 8 | +ticketid: 1678618 |
| 9 | +res_type: kb |
| 10 | +--- |
| 11 | + |
| 12 | +## Environment |
| 13 | + |
| 14 | +| Version | Product | |
| 15 | +| --- | --- | |
| 16 | +| 2025 Q1 or later | Telerik UI for ASP.NET AJAX | |
| 17 | + |
| 18 | +## Description |
| 19 | + |
| 20 | +I want to be able to activate the Telerik License without creating classes or adding code to the `App_Code` folder. I want to ensure proper implementation of Telerik UI for ASP.NET AJAX licensing in a setup where an ASP.NET Web site project is used assemblies are referenced by adding the dll to the bin folder. |
| 21 | + |
| 22 | +This knowledge base article also answers the following questions: |
| 23 | +- Can I activate a the Telerik License using a `DLL` in the `Bin` folder? |
| 24 | +- How to activate the Telerik License without adding any code to the `App_Code` folder? |
| 25 | +- How to resolve assembly mismatches with Telerik.Licensing.Runtime.dll during production? |
| 26 | + |
| 27 | +## Solution |
| 28 | + |
| 29 | +### Creating a License Key Assembly |
| 30 | + |
| 31 | +1. In Visual Studio [Create a Class Library (.NET Framework)](https://learn.microsoft.com/en-us/dotnet/core/tutorials/library-with-visual-studio) project and name it something like TelerikLicenseKey |
| 32 | +2. Reference the Telerik Licensing |
| 33 | + - **Option 1**: Install the `Telerik.Licensing` NuGet package the project through the Nuget Package Manager |
| 34 | + - **Option 2**: Add a [NuGet PackageReference](https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files) to the project file (`.csproj` or `.vbproj`). |
| 35 | + ````XML |
| 36 | + <ItemGroup> |
| 37 | + <PackageReference Include="Telerik.Licensing" Version="[1.4.6,2.0)" /> |
| 38 | + </ItemGroup> |
| 39 | + ```` |
| 40 | +3. Download your Telerik License Key: |
| 41 | + - Navigate to the [License Keys](https://www.telerik.com/account/your-licenses/license-keys) page in your Telerik account. |
| 42 | + - Locate the Telerik UI for ASP.NET AJAX row and click the "View Key" link. Select the programming language and Copy the license key. |
| 43 | + |
| 44 | +4. Add the License Key to the project |
| 45 | + - In the Class Library, add the copied License Key Script to `Properties > AssemblyInfo.cs` |
| 46 | + |
| 47 | +5. Build the project then copy the compiled assembly e.g. `TelerikLicenseKey.dll` to the `Bin` folder of the Web site project you are aiming to activate the Telerik License for. |
| 48 | + |
| 49 | +>This works as if adding the License key to a Class in the `App_Code\` folder, except that the Class Library will need to be maitnained separately to keep the `Telerik.Licensing.Runtime.dll` up-to-date in case the Telerik UI gets updated. |
| 50 | + |
| 51 | +### Addressing Assembly Mismatches |
| 52 | + |
| 53 | +If you encounter assembly mismatch errors, follow these steps: |
| 54 | + |
| 55 | +1. **Use Binding Redirects**: |
| 56 | + - Add a binding redirect to your `web.config` to resolve mismatches between versions of `Telerik.Licensing.Runtime.dll`. Example: |
| 57 | + ```xml |
| 58 | + <?xml version="1.0"?> |
| 59 | + <configuration> |
| 60 | + <runtime> |
| 61 | + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
| 62 | + <dependentAssembly> |
| 63 | + <assemblyIdentity name="Telerik.Licensing.Runtime" publicKeyToken="98bb5b04e55c09ef" culture="neutral" /> |
| 64 | + <bindingRedirect oldVersion="0.0.0.0-1.6.5.0" newVersion="1.6.5.0" /> |
| 65 | + </dependentAssembly> |
| 66 | + </assemblyBinding> |
| 67 | + </runtime> |
| 68 | + </configuration> |
| 69 | + ``` |
| 70 | + |
| 71 | +2. **Version Compatibility**: |
| 72 | + - Ensure the `Telerik.Licensing.Runtime.dll` version referenced to the Class Library matches the Telerik version in your Web site project. |
| 73 | + |
| 74 | +## See Also |
| 75 | + |
| 76 | +- [License Key Installation](https://www.telerik.com/products/aspnet-ajax/documentation/licensing/license-key#setup-your-license-key) |
| 77 | +- [Web Application Projects vs. Web Site Projects](https://learn.microsoft.com/en-us/previous-versions/aspnet/dd547590(v=vs.110)) |
| 78 | +- [Adding Binding Redirects in Web.config](https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions) |
0 commit comments