Click or drag to resize
AB4D logo

LicenseHelperApplicationLicenseKey Property

ApplicationLicenseKey can be set to the special license key that is valid only for the specified application. This allows the application to run on computers without installed products and withouth using license.licx file to embed the license key into the application.

Namespace: Ab3d.Licensing.PowerToys
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.1.8864.1045
Syntax
C#
public static string ApplicationLicenseKey { get; set; }

Property Value

String
Remarks

Usually licensing of AB4D libraries is done with using the standard .Net components licensing mechanism.

This mechanism works with adding a license.licx file to the project and set its content to the specified type that contain the licensing code. When the .Net compiler gets the license.licx file, it calls the licensing code. That code gets the installed license key from registry and saves a special runtime license key into the compiled assembly. This means that at runtime, the licensed library can read the runtime license key from the assembly and can allow application to use the licensed library.

The ApplicationLicenseKey property provides an alternative option to use licensed library on other computers.

Instead of using license.licx file it is possible to set the ApplicationLicenseKey to the special license key. This special license key is checked by licensing code and if valid it allows using the licensed library.

The value of ApplicationLicenseKey cannot be set to the license key that is get from User Accont page. Instead a special license key is needed. This license key includes the name of the target application and can be used only for the application for which it was created for. This means that even if the license key would be obtained from the application with decompilation, it cannot be used on another application.

To get the special license key please write a request to support@ab4d.com and pride the name of the application that will use the ApplicationLicenseKey. The name of the application can be get with running the following code while the application is running:

C#
string applicationName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;

IMPORTANT:
The ApplicationLicenseKey must be set before any of the objects from Ab3d.PowerToys is created!
It is recommended that the EmbeddedLicenseAssembly is set in the constructor of the class that is using Ab3d.PowerToys and before call to InitializeComponent method.

Example

The following code shows how to set the assembly in the constructor of the class that is using Ab3d.PowerToys.

C#
public class MyClass()    
{
    public MyClass()
    {
        Ab3d.Licensing.PowerToys.LicenseHelper.ApplicationLicenseKey = "1234-5678-...";

        InitializeComponent();
    }
}
See Also