Redistributing Telerik Assemblies

The Telerik UI for Silverlight suite includes a limited run-time royalty-free license to redistribute the controls in your own solutions subject to the License Agreement. You can use the components in the suite to build your own solutions and redistribute your solutions to your end users who are not required to purchase a license from Telerik to access your solution.

Protecting Telerik UI Assemblies

Technical guidelines for protecting Telerik UI for Silverlight by Progress binaries when redistributed with other applications.

There are a couple of approaches that you can take:

Protect the Telerik Assemblies Using the PowerShell Scripts

Telerik UI source code provides two power shell scripts that will allow you to easily apply the modifications needed to protect the Telerik assemblies without the need to open and edit any files. The scrips are located in the Build\BuildInstructions\AssemblyProtection folder of the suite's source code which can be downloaded as explained in this article.

The available scripts are:

  • ApplicationNameModifier.ps1: Uncomments the ValidatePassPhrase() method call and changes the ApplicationName in the Core\Controls\Common\AssemblyProtection.cs file with the provided one.

  • ApplicationNameModifier - DPL.ps1: Uncomments the ValidatePassPhrase() method call and changes the ApplicationName in the Documents\Licensing\AssemblyProtection.cs file with the provided one.

Instructions

  1. Right-click on the needed script and click Run with PowerShell menu item

    run script with PowerShell

  2. Enter the new ApplicationName when prompted:

    change the application name

  3. Rebuild the Telerik UI assemblies using one of the approaches explained in the source code build instructions (located in the Build\BuildInstructions folder).

  4. In your application resources App.xaml create a string resource with key "Telerik.Windows.Controls.Key" and value equal to the value of the ApplicationName defined in step 2:

Example 1: Merging the application key resource

<Application  
      xmlns="http://schemas.microsoft.com/client/2007" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
      xmlns:system="clr-namespace:System;assembly=mscorlib" 
      x:Class="..."> 
        <Application.Resources> 
            <system:String x:Key="Telerik.Windows.Controls.Key">Sample Application Name v2.0 (tm)</system:String> 
        </Application.Resources> 
</Application> 

Protect the Telerik Assemblies by Manually Editing the Source Code

Prerequisites

All control assemblies should be built from source code due to modifications applied to the source files. The source code of UI for Silverlight is distributed separately and is bundled with build instructions. Please, read the source code building instructions beforehand. For brevity, this document assumes that the source distribution ZIP file is extracted in C:\TelerikSilverlightSource

Instructions

  1. Open C:\TelerikSilverlightSource\Core\Controls\Common\AssemblyProtection.cs in a text editor (notepad, Visual Studio, etc.)

  2. Uncomment the following line:

    Example 2: Before the change

        public static void Validate() 
        { 
            //Uncomment the following line 
            //ValidatePassPhrase(); 
        } 
    

    Example 3: After the change

        public static void Validate() 
        { 
            //Uncomment the following line 
            ValidatePassPhrase(); 
        } 
    
  3. Change the ApplicationName constant to match the name of your application:

    Example 4: Before the change

        internal const string ApplicationName = "MyApp"; 
    

    Example 5: After the change

        internal const string ApplicationName = "Sample Application Name v2.0 (tm)"; 
    
  4. Save AssemblyProtection.cs and rebuild the suite (described separately in the source code build instructions document).

  5. In your application, replace the existing references to the Telerik assemblies with the ones built from the source code.

  6. If you run the application now you should get an exception with the message "This version of Telerik UI for Silverlight is licensed only for use by Sample Application Name v2.0 (tm)". Note that "Sample Application Name v2.0 (tm)" will be replaced with the value of the ApplicationName constant.

  7. In your application resources App.xaml create a string resource with key "Telerik.Windows.Controls.Key" and value equal to the value of the ApplicationName constant from step 3:

    Example 6: Merging the application key resource

        <Application  
              xmlns="http://schemas.microsoft.com/client/2007" 
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
              xmlns:system="clr-namespace:System;assembly=mscorlib" 
              x:Class="..."> 
                <Application.Resources> 
                    <system:String x:Key="Telerik.Windows.Controls.Key">Sample Application Name v2.0 (tm)</system:String> 
                </Application.Resources> 
        </Application> 
    

Protect the Telerik Documents Assemblies by Editing the Source Code

The instructions in the previous section explain how to build the Telerik.Windows.Controls assembly and the assemblies depending on it. The UI for Silverlight suite contains libraries for processing documents that do not depend on Telerik.Windows.Controls.dll.

If you are building the assemblies needed for one of the components depending on Telerik.Windows.Documents.Core, such as the Telerik Document Processing by Progress libraries, you need to execute the following steps as well.

The following instructions are valid for Telerik UI for Silverlight version Q2 2014 or later.

  1. Open C:\TelerikDocumentsProcessingSource\Documents\Licensing\AssemblyProtection.cs in a text editor (notepad, Visual Studio, etc.).

    In versions of the suite prior to R2 2016, the path is C:\TelerikDocumentsProcessingSource\Documents\Core\Core\Licensing\AssemblyProtection.cs.

  2. Uncomment the following line:

    Example 7: Before the change

        public static bool IsValid() 
        { 
            // Uncomment the following line 
            // return ValidatePassPhrase(); 
            return true; 
        } 
    

    Example 8: After the change

        public static bool IsValid() 
        { 
            // Uncomment the following line 
            return ValidatePassPhrase(); 
        } 
    
  3. Execute steps 3-7 from the previous section.

Building the Source Code After Assembly Protection Code Changes

After enabling the assembly protection by modifying the code as shown in the previous section of this article, the source code of Telerik UI for WPF should be rebuilt. The produced DLLs can be redistributed with the final product. To see how to properly rebuild the source code, check the following documents in the .zip file with Telerik's source:

  • C:\Telerik UI for WPF Source Code\Build\BuildInstructions\Source Code Build Instructions for .NET Framework (4.6.2).rtf
  • C:\Telerik UI for WPF Source Code\Build\BuildInstructions\Source Code Build Instructions for .NET.rtf

See Also

In this article