# Application Licensing

> Set TextControl.EntryAssembly in a WPF user control library and ServerTextControl.EntryAssembly in a class library, and keep license files out of installers.

- **Product:** TX Text Control .NET for WPF
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for WPF > Installation Guide > License Configuration > Application Licensing
- **2078 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/installation/licensing/application/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/installation/licensing/application/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/installation/licensing/application/llms-full.txt

---

Once a WPF application is built, its TX Text Control license is part of one of its assemblies. The people who install and run it need no serial number, no license file and no activation. What you decide as a developer is which assembly holds the license, which matters as soon as the `TextControl` lives in a user control library or `ServerTextControl` in a class library, and what stays out of the files you ship.

### Where the License Lives

At build time, the license is compiled into your assembly: from *txtextcontrol.wpf.license* in .NET projects, and from *licenses.licx* in .NET Framework projects. [Development Licenses](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/installation/licensing/development/llms-full.txt) covers both.

By default, TX Text Control checks the license in the application's executable assembly. That fits an application whose windows contain the controls directly. If TX Text Control is used in another assembly, such as a WPF user control library, a class library or a unit test project, the executable doesn't have the license, and TX Text Control has to be told where it is.

Applications built with TX Text Control .NET for WPF are royalty-free: you may distribute them to any number of users. See [Licensing Overview](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/overview/licensing/llms-full.txt).

### User Controls and Class Libraries

Since version 32.0 with Service Pack 2, TX Text Control can run in a library that is called from assemblies without a license. Two static properties name the assembly with the license:

| Property | Set it for |
|---|---|
| [TextControl.EntryAssembly](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/entryassembly-property/llms-full.txt) | The WPF `TextControl` in `TXTextControl.WPF` |
| [ServerTextControl.EntryAssembly](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/servertextcontrol/entryassembly-property/llms-full.txt) | `ServerTextControl`, which processes documents without a user interface |

Both properties can only be set, at run time, and default to the application's executable assembly. A library that uses both types sets both.

#### A WPF User Control

A WPF user control library that references `TXTextControl.TextControl.WPF.SDK` contains an editor with a button bar. Its XAML, *EditorControl.xaml*, is:

```xml
<UserControl x:Class="MyControls.EditorControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:WPF="clr-namespace:TXTextControl.WPF;assembly=TXTextControl.WPF">
    <DockPanel>
        <WPF:ButtonBar x:Name="buttonBar1" DockPanel.Dock="Top" />
        <WPF:TextControl x:Name="textControl1" ButtonBar="buttonBar1" />
    </DockPanel>
</UserControl>
```

The code-behind, *EditorControl.xaml.cs*, sets the entry assembly before `InitializeComponent` creates the `TextControl` from the XAML:

```csharp
using System.Windows.Controls;

namespace MyControls
{
    public partial class EditorControl : UserControl
    {
        public EditorControl()
        {
            // The license is compiled into this control library
            TXTextControl.WPF.TextControl.EntryAssembly = typeof(EditorControl).Assembly;

            InitializeComponent();
        }
    }
}
```

The code works as follows:

- `typeof(EditorControl).Assembly` is the control library, into which the build compiled *txtextcontrol.wpf.license*.
- The property is set in the constructor, before `InitializeComponent`, because the license is checked when the `TextControl` is created.
- The type is written with its namespace, `TXTextControl.WPF.TextControl`, so the file needs no `using` directive for TX Text Control.

#### A Class Library With ServerTextControl

A class library that creates documents without a user interface sets `ServerTextControl.EntryAssembly` in the same way:

```csharp
using TXTextControl;

namespace MyLibrary
{
    public class DocumentService
    {
        public DocumentService()
        {
            // The license is compiled into this class library
            ServerTextControl.EntryAssembly = typeof(DocumentService).Assembly;
        }

        public byte[] CreatePdf(string text)
        {
            using (ServerTextControl tx = new ServerTextControl())
            {
                tx.Create();
                tx.Text = text;

                byte[] pdf;
                tx.Save(out pdf, BinaryStreamType.AdobePDF);
                return pdf;
            }
        }
    }
}
```

The code works as follows:

- The constructor names the library as the licensing assembly, before any `ServerTextControl` is created.
- [Create](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/servertextcontrol/create-method/llms-full.txt) initializes the instance, [Text](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/servertextcontrol/text-property/llms-full.txt) sets its content, and [Save](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/servertextcontrol/save-method/llms-full.txt) with [BinaryStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/binarystreamtype/enumeration/llms-full.txt) `AdobePDF` returns the document as PDF.

The WPF application that uses `EditorControl` or `DocumentService` references only your library. It needs no reference to TX Text Control and no license of its own. Unit test frameworks such as NUnit and MSTest, which run your tests from precompiled assemblies, are the other case the property was made for.

- **In .NET Framework projects with *licenses.licx*, and before version 32.0 with Service Pack 2,** the license had to be in the calling executable. Add *licenses.licx* with the entries, and the references to TX Text Control, to the main project.
- **Don't rename an assembly after it is built.** The license is stored in its resources and is not found under a new name. Change the assembly name in the project settings and rebuild instead.

### The Edition at Run Time

A license covers the features of one edition. Code that uses a feature the licensed edition doesn't include throws a [LicenseLevelException](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/licenselevelexception/llms-full.txt). [Editions and Feature Availability](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/overview/editions/llms-full.txt) lists the features per edition.

### What Stays Out of Your Installer

Your application ships only the files Text Control designates as redistributable. Serial numbers, the license file *txtextcontrol.wpf.license* and a *nuget.config* with your API token must not reach your users; [What Stays Out of the Installer](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/deployment/licensing/#what-stays-out-of-the-installer) in the Deployment Guide has the complete list, and [Redistribution Overview](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/deployment/redistribution/llms-full.txt) lists the files to ship.

### Related Pages

- [Development Licenses](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/installation/licensing/development/llms-full.txt): how the license gets into a project.
- [Build Servers](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/installation/licensing/build-servers/llms-full.txt): building licensed applications in CI/CD pipelines.
- [Embedding the Editor in Windows and UserControls](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/integration/embedding/llms-full.txt): user controls with a `TextControl`.
- The blog article [Encapsulating TX Text Control in Class Libraries](https://www.textcontrol.com/blog/2024/01/09/encapsulating-tx-text-control-in-class-libraries/): a class library with `ServerTextControl`, step by step.

---

## Nearby

- **Previous:** [Development Licenses](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/installation/licensing/development/llms-full.txt)
- **Next:** [Build Servers](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/installation/licensing/build-servers/llms-full.txt)
