[]
        
(Showing Draft Content)

Licensing Compiled Code

Generating Licenses for Compiled Code and Azure Functions

This section describes how to manually generate a license file for compiled code (such as class libraries) or applications deployed to Azure Functions.

By default, ActiveReports licensing is applied to the main executable application. However, if ActiveReports is embedded in a custom library (DLL) that is referenced by another application, a "License not found" error may occur at runtime. To resolve this, you must explicitly generate a license file for the target application and embed it into your library.

Prerequisites

Ensure the MESCIUS License Manager command-line tool (sa3client) is installed on your machine. You can install it as a global tool via NuGet:

dotnet tool install -g sa3client

1. Generate the License File

Use the sa3client tool to generate a .sa3licx license file. You must specify the Product Code (e.g., "ARS"), the target application name, and the output file path.

Syntax:

sa3client lc -p "ARS" -t <Target App Name> -o <Path to Output .sa3licx>

Scenario A: Class Library Referenced by a Main App

If you have a library (e.g., UserControlLibrary) used by a main application (e.g., MainApp), you must generate the license targeting the Main Application.

Example:

sa3client lc -p "ARS" -t "MainApp" -o ".\MainApp.sa3licx"

(Note: Ensure the target name matches the Entry Assembly name of the calling application exactly.)

Scenario B: Azure Functions

To license an application running on Azure Functions, the target name must follow the Azure Functions assembly naming convention.

Example:

sa3client lc -p "ARS" -t "Microsoft.Azure.WebJobs.Script.WebHost.[Assembly Name].dll" -o ".\AzureFunc.sa3licx"

2. Embed the License in Your Project

Once the .sa3licx file is generated, follow these steps to integrate it into your library project (e.g., UserControlLibrary):

  1. Copy the file: Place the generated .sa3licx file into your project folder.

  2. Set Build Action: In your IDE (e.g., Visual Studio), select the file and change its Build Action to Embedded Resource.

  3. Disable Auto-Generation: Open your project's .csproj file and add the following property to disable the automatic build-time license generation (which may conflict with your manual file):

    <PropertyGroup>
        <GenerateArLicense>false<GenerateArLicense>
    </PropertyGroup>
  4. Rebuild: Rebuild your solution.

Your control will now be able to look up the valid license for the 'MainApp' (or Azure Function) from within the 'UserControlLibrary' assembly.


Advanced: Handling Multiple Entry Applications

If your library is shared across multiple applications (e.g., MainApp1 and MainApp2), you must include a specific license file for each application.

  1. Generate unique files for each app:

    # Generate license for MainApp1
    sa3client lc -p "ARS" -t "MainApp1" -o ".\MainApp1.sa3licx"
    
    # Generate license for MainApp2
    sa3client lc -p "ARS" -t "MainApp2" -o ".\MainApp2.sa3licx"
  2. Embed all files: Add both MainApp1.sa3licx and MainApp2.sa3licx to your library project.

  3. Set Build Actions: Set the Build Action for both files to Embedded Resource.

Important Notes:

  • Internet Connection: The sa3client tool requires an active internet connection to verify and generate the license.

  • Runtime Resolution: For the license to apply at runtime, the Target Name (-t) used during generation must exactly match the name of the process/assembly calling your library.