Show / Hide Table of Contents

License validation

Learn how you can check if a given license feature is present on a users PC.

Use this procedure to check the availablility and expirey date of a license feature.

  1. Check for the license based on the feature provided and display appropriate message.

  2. Get license information.

Solution

  1. string licenseExpirationDate = string.Empty;
    string feature = "Myfeature";
    
    //AcquireLicense
    bool result = LicenseValidator.AcquireLicense(feature, LicenseHoldType.AllowRelease);
    if (result == false)
    {
        Logger.AddMessage(new LogMessage("Invalid License"));
    }
    
  2. //Get license expiration date
    LicenseInformation info;
    bool ret = LicenseValidator.GetLicenseInformation(feature, out info);
    if (ret == true)
    {
        licenseExpirationDate = info.ExpirationDate.ToShortDateString();
    }
    

Example

This example provides information to check for license.

private static bool ValidateLicense()
{
    string licenseExpirationDate = string.Empty;
    string feature = "Myfeature";

    //AcquireLicense
    bool result = LicenseValidator.AcquireLicense(feature, LicenseHoldType.AllowRelease);
    if (result == false)
    {
        Logger.AddMessage(new LogMessage("Invalid License"));
    }

    //Get license expiration date
    LicenseInformation info;
    bool ret = LicenseValidator.GetLicenseInformation(feature, out info);
    if (ret == true)
    {
        licenseExpirationDate = info.ExpirationDate.ToShortDateString();
    }

    return result;
}

Required Namespaces

ABB.Robotics.RobotStudio.Environment

ABB.Robotics.RobotStudio.Stations

In this article
Back to top Copyright © 2025 ABB