---
title: "Registering Production License Keys"
canonical: https://www.graphicsmill.com/docs/gm/registering-production-license-keys.htm
product: "Graphics Mill"
---

# Registering Production License Keys
 
This article describes license types and how you can register a production license key. If you want to evaluate Graphics Mill before you purchase a license, you can get a trial license key as described in the [Evaluating Graphics Mill](https://www.graphicsmill.com/docs/gm/evaluating-graphics-mill.htm.md) topic.
 
There are several ways to register a license key for Graphics Mill:
 
1. On a development computer, you can set a license key in the source code of your application.
2. On a development web server, you can set a license key in the application's `web.config` file.
3. You can register a license key using the LIC file on a production or development web server.
4. You can apply a license by setting the GRAPHICSMILL_LICENSE_KEY environment variable.
5. You can also apply a license key by updating the Windows Registry manually.

## License Types
  
Graphics Mill works with the following license types:
 
- **Evaluation** is a full-featured license that works for two weeks.
- **Developer** is needed for development and should be used on your development machine.
- **Desktop Application** is bound to a strong name (public key token) and can be used for distributing royalty-free Windows-based desktop applications. To generate such a license, generate a token on your development machine using `sn.exe` and send the public token to Aurigma; no activation code is required. If this license type is unavailable in your account, you can contact our [support team↗](http://www.graphicsmill.com/account/cases/add).
- **Floating license** is designed for containerized environments. No activation code is required - just provide the number of seats you need.
- **Server Application** allows you to install Graphics Mill on a server. This license requires you to specify your activation code.
- **Enterprise Application** has a custom licensing policy and is not generally available.

### Editions
 
For server licenses, Graphics Mill is available in two editions: **Standard** and **Professional**. The **Professional** edition includes the **Standard** edition's features, but additionally supports reading PSD (Photoshop) files.
 
### Activation codes
 
When Graphics Mill fails to locate a valid license, it displays an error message containing an activation code. Please provide this code to our support team, who will issue the corresponding license for your environment. Then, find the license in your Graphics Mill account.
 
## License Key Formats
  
Starting from Graphics Mill 10, license keys have the following format:
 `gm.std.dev.max:5.maint:2018-01-01_QJ8Zbs68BtSXG6a2/AFlXY65LWC//WUfX5yv8NJmaHiIZbgwKWhpn3+GdWcFZ1h3fjRmIM3ZKwH2sqQ2pCYilpACFuFFOiuUpJJIaw6fEzbmEEuZnVlkfpRd450HChjddA==` 
You may notice that such a key contains license parameters in its prefix.
 
License keys of earlier versions look as follows:
 `80FF0-020B2-99F10-00074-942DF-5E924B`
 
## Registering the License Key
  
### In the Source Code
 
In your application, you can specify a license key by using the static method [License.Set(String)](https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Licensing_License_Set_1_bb3a7a4f.htm.md).
 
```csharp
var key = "<YOUR_LICENSE_KEY>";
Aurigma.GraphicsMill.Licensing.License.Set(key);
```
 
### In the web.config File
 
This way is not available in the .NET 9 build of Graphics Mill, because it does not read the `appSettings` section. See [Using Graphics Mill in .NET projects](https://www.graphicsmill.com/docs/gm/using-graphics-mill-in-dotnet-projects.htm.md) for details.
 
On a development web server, you can apply a license key in your application's `web.config` file. To perform this, insert your license key in the `appSettings` section. For example, for Graphics Mill 10 this key may look as follows:
 
```xml
<appSettings>
    <add key="GraphicsMillLicenseKey" value="<YOUR_LICENSE_KEY>" />
</appSettings>
```
 
**Important** 
Don't use this approach with Enterprise licenses (with custom licensing) if you deliver a third-party solution as it may disclose your license key.
 
### Using a LIC File
 
If you deploy a web application on a server where you have no permission to patch the registry, you can register a production key using a LIC file.
 
**Important** 
If you develop a desktop application, **do not include a production license key in the end product using a LIC file**!
 
1. Create a new text file named `Aurigma.GraphicsMill.lic`.
2. Insert your license key into this file. Make sure that this file has no extra characters, such as white spaces, etc.
3. Copy this file into the `\bin` folder of your web application.

### Using an Environment Variable
 
You can apply a license by setting the `GRAPHICSMILL_LICENSE_KEY` environment variable. This is particularly useful for containerized deployments where using a registry or file-based license is inconvenient.
 
1. Set the `GRAPHICSMILL_LICENSE_KEY` environment variable to your license key.
2. If you're using a container (e.g., Docker), pass the variable using the `-e` flag or through your orchestration tool (Kubernetes secrets, etc.).
3. For IIS or Windows services, set the variable at the system level or within the application pool and restart the service.

### Using the Licenses.licx File
 
This way is not available in .NET projects. It works only in .NET Framework projects.
 
This approach is intended for desktop applications and requires a **Desktop Application** license. You should apply all the steps described in this section on the development machine only. After you execute these instructions correctly, a production license key will be imported into the resources of your application. Therefore you do not need to register Graphics Mill on the customers' workstations.
 
1. Register Graphics Mill on the development machine using one of the methods described in this article (for example, in the source code or the web.config file).
2. If Visual Studio is already open, close it and then reopen it.
3. Add a new text file named `Licenses.licx` (you cannot give this file any other name) into the project, or open an existing one. 
**Note** 
Normally, Visual Studio hides this file in the **Solution Explorer**. That's why it is possible that this file already exists in your project (under certain circumstances it is auto-generated). In this case, click **Show All Files** on the **Solution Explorer** tree pane to see this file.
 
If you use Graphics Mill as a custom control application (rather than in an end-user desktop application), you should add the `Licenses.licx` file into the desktop application that uses your control.
4. Add the following string into this file:
 
    `Aurigma.GraphicsMill.Bitmap,Aurigma.GraphicsMill`
 
    In other words, you should add the name of the licensed class and DLL name without the file extension, separated by a comma.
5. Rebuild the project (not the solution).

**Note** 
If the license key works on the developer's machine and does not work on the customers' workstations, this most likely means that there are some problems with the `Licenses.licx` file. In this case, check whether you have correctly performed Step 2 above.
 
#### Resolving a Problem with the License Type Exception
 
When you compile your application and obtain the *LicenseException: This license type cannot be embedded into the assembly*, you should verify the license type of the registered key.
 
**Important** 
To embed a license key into an assembly, you need a **Desktop Application** license. Such a key must be in the registry at the compilation time.
 
### Building a license resource for desktop applications
 
If you have a complicated build process or don't want to have a dependency on a registry, it is possible to build a resource for your desktop application manually. In this case, it's not necessary to have a license for the currently building application in the registry.
 
1. Place the following files in your working folder:
    - `Aurigma.GraphicsMill.dll` - the actual version of Graphics Mill you are going to reference.
    - `Aurigma.GraphicsMill.lic` - a text file with the license key.
    - `complist.txt` - a text file with `Aurigma.GraphicsMill.Bitmap,Aurigma.GraphicsMill` string, like in the licenses.licx.
2. Run the License Compiler.
 `lc.exe` is a part of Windows SDK, so the probable path where you can find it looks like this:
 `"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.1 Tools\x64"` 
    Run this on the command line:
 `lc.exe /target:YourApplicationName.exe /complist:complist.txt /i:Aurigma.GraphicsMill.DLL` 
    Then, find the generated `yourapplicationname.exe.licenses` file.
 
**Note** 
The bitness of `lc.exe` and `Aurigma.GraphicsMill.dll` files must be the same.
3. Embed the resource in your project.
Now you need to put the file obtained in the previous step in your project directory and add the following lines to your `.csproj` file: 
```xml
    <Target Name="BeforeBuild">
      <ItemGroup>
        <EmbeddedResource Include="yourapplicationname.exe.licenses">
          <LogicalName>YourApplicationName.exe.licenses</LogicalName>
        </EmbeddedResource>
      </ItemGroup>
    </Target>
    ```
4. Build the project and check that the license is applied correctly.

**Important** 
You need to repeat these steps each time you update your license or Graphics Mill version.
 
### Updating the Windows Registry Manually
 
You can apply a license key by updating the Windows Registry manually. To perform this, download your license key from [My Licenses & Downloads↗](http://www.graphicsmill.com/account/licenses) and create the `.reg` file or update the following keys of the Windows Registry, depending on your Graphics Mill version:
 
- Starting from Graphics Mill 10: 

    ```
    [HKEY_LOCAL_MACHINE\SOFTWARE\Aurigma\Graphics Mill for .NET\10.0]
    "License Key"="YOUR_KEY"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Aurigma\Graphics Mill for .NET\10.0]
    "License Key"="YOUR_KEY"
    ```
- Earlier versions: 

    ```
    [HKEY_LOCAL_MACHINE\SOFTWARE\Aurigma\Graphics Mill for .NET\6.0]
    "License Key"="YOUR_KEY"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Aurigma\Graphics Mill for .NET\6.0]
    "License Key"="YOUR_KEY"
    ```

Also, you can download the `.reg` file from the following link: [Register License Key Offline↗](http://www.graphicsmill.com/account/licenses/register-offline).
 
## License Resolution Order
  
Graphics Mill checks for a license in the following order. The first valid license found is used.
 
1. Code (set programmatically)
2. AppSettings (in configuration file)
3. LIC file
4. WebBin LIC file
5. Environment variable (GRAPHICSMILL_LICENSE_KEY)
6. Registry
 
## License Key Validation
  
If you have a version earlier than Graphics Mill 10, you can check whether the registered license key is a trial or production key as well as obtain the expiration date. The following code sample demonstrates how to perform that check.
 
```csharp
var license = Aurigma.GraphicsMill.Configuration.License;
if (license.IsTrial)
{
    Console.WriteLine("Evaluation period expires on " + license.ExpirationDate.ToString());
}
else
{
    Console.WriteLine("Maintenance period expires on " + license.MaintenanceExpirationDate.ToString());
}
```
 
Graphics Mill 10 allows you to check the following license parameters.
 
```csharp
var lic = Aurigma.GraphicsMill.Configuration.License;
Console.Write(System.String.Format("{0};{1};{2};{3};{4};{5};",lic.Source,    // a license keylic.IsTrial,   // whether this is an evaluation licenselic.ExpirationDate,            // the license expiration datelic.MaintenanceExpirationDate, // the maintenance periodlic.IsDeveloper,    // whether this is a Developer licenselic.IsDesktopOnly   // whether this license is for desktop use only
));
```
