Atalasoft Knowledge Base

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



This article refers to .NET 5 and .NET 6 using 11.4 and newer and our .NET 5 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 5 / .NET 6

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 5 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
  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.4\ 
    (for version 11.4.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 5 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 5.

The wording may lead some to belive this is ONLY .NET 5, but the intent was to explain that this is needed for .NET5 and up (for .NET 6 for 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

Last Modified: 2 Years Ago
Last Modified By: Tananda
Rated 1 star based on 1 vote
Article has been viewed 1.5K times.
Also In This Category