Search

Atalasoft Knowledge Base

HOWTO:License a .NET 6 / 8 Application (embedding license in an exe)

Tananda
DotImage

NOTE:

This article refers to .NET 6 / .NET 8 using 11.5 and newer and our .NET 6 dlls. It does not apply to .NET Framework apps as MS Visual Studio automatically provides the needed lc.exe steps - see HOWTO: License an EXE for Deployment (.NET Framework)

Licensing for .NET 6 / .NET 8

For .NET 5 or later, the License Compiler is not supported. Instead, use the Atalasoft License Compiler (AtalasoftLicenseCompiler.exe) provided via a NuGet package to transform and embed the license binary resource. Just like the License Compiler, the Atalasoft License Compiler takes the licenses.licx file that was generated or updated by Windows Form Designer or added manually, transforms the file into a .licenses binary resource, and embeds it into the project output.

The Atalasoft License Compiler can be run separately, and it uses the same command-line arguments as the License Compiler, as in this example:

AtalasoftLicenseCompiler.exe/complist:<licenses.licx_path>/outdir:<result_folder_path> /target:<application_name>/i:"<refassembly1>;<refassembly2>;<refassembly3>;..;<refassemblyN>"

But to embed licensing, you need to install the Atalasoft.dotImage.AtalasoftLicenseCompiler.x86 or Atalasoft.dotImage.AtalasoftLicenseCompiler.x64 NuGet package for .NET 6 project. The NuGet package includes AtalasoftLicenseComplier.exe and the appropriate targets and instructions for *.licenses generation. Targets are added to the .csproj file during compilation.

To use the Atalasoft License Compiler, follow these steps:

  1. Install the NuGet package, either
    Atalasoft.dotImage.AtalasoftLicenseCompiler.x86
    or
    Atalasoft.dotImage.AtalasoftLicenseCompiler.x64.
  2. Create or add the licenses.licx file.
    If you create the file, make sure it is in <project folder>/Properties/. If you add it, follow the instructions in HOWTO: License an EXE for Deployment (.NET Framework) on the Atalasoft website.
  3. Build the project.
    During compilation, the following takes place:
    1. The AtalasoftLicenseComplier.exe utility and necessary assemblies are copied to/lib.
    2. The .licenses file is generated and embedded into the resulting application file.
  4. Check the build log file for any errors.
  5. Most common errors include "unable to find Atalasoft.dotImage.lic in the following locations" followed by a list of 3 locations - the default and preferred location should be
    c:\users\YOUR_USERNAME\AppData\Local\Atalasoft\DotImage 11.5\ 
    (for version 11.5.x.x.xxxx etc...)
    Other errors related to "invalid license signature" or "License version out of date" have specific meanings - in cases such as this please create a support case with Atalasoft and provide the full exception message/ log output message - as text  - please copy/paste from the error output and/or exception message and stack trace - do not provide it as a screenshot.

If the license is not found for the assembly, an error message is added to the build log, but the build does not fail.

This means that upon successful build you should test your embedded license exe

HOWTO:Verify That You Have Successfully Embedded Licensing in EXE

AtalasoftLicenseCompiler.exe is for .NET 6 AND UP...

It has recently come to our attention that some customers have been misled by some confusing wording on the Atalasoft.dotImage.AtalasoftLicenseCompiler.exe.x64 and Atalasoft.dotImage.AtalasoftLicenseCompiler.exe.x86 packages which the description says:

AtalasoftLicenseCompiler.exe utility is created to support licensing mechanism based on *.licx and *.licenses files only for .Net 6  and up.

The wording may lead some to believe this is ONLY .NET 6, but the intent was to explain that this is needed for .NET6 and up (for .NET 8for instance) but not for any .NET Framework as .NET Framework has a built in lc.exe from Microsoft which handles that automatically

AtalasoftLicenseCompiler.exe is absolutely intended for use in .NET 6

Details
Last Modified: 2 Weeks Ago
Last Modified By: Tananda
Type: HOWTO
Rated 1 star based on 1 vote
Article has been viewed 2.5K times.
Options
Also In This Category