Application Licensing
Applications built with TX Text Control .NET for Windows Forms carry their license inside: it is compiled into an assembly of the application, and the users who install it need no license, serial number or activation of their own. What matters is which assembly holds the license, especially when TX Text Control is used in a class library or a user control, and what must never be shipped.
Where the License Lives
When you build your application, the license is compiled into your assembly: in .NET projects from the license file of the NuGet package, in .NET Framework projects from licenses.licx. See Development Licenses.
By default, TX Text Control looks for the license in the application's executable. That works when the controls are on the forms of the application itself. When TX Text Control is used in a separate assembly, such as a class library, a user control or a unit test project, the executable does not hold the license, and you tell TX Text Control where it is.
End users need nothing: applications are distributed royalty-free, to any number of users and machines. See Licensing Overview.
Class Libraries and User Controls
Since version 32.0 with Service Pack 2, TX Text Control can be used in a class library or a user control that is called from assemblies without a license. The static properties TextControl.EntryAssembly and ServerTextControl.EntryAssembly name the assembly that holds the license. By default, this is the application's executable.
A user control in a control library sets the property in its constructor, before InitializeComponent creates the TextControl:
using System.Windows.Forms;
using TXTextControl;
public partial class MyUserControl : UserControl
{
public MyUserControl()
{
// The license is compiled into this control library
TextControl.EntryAssembly = typeof(MyUserControl).Assembly;
InitializeComponent();
}
}
A class library that processes documents with ServerTextControl does the same with ServerTextControl.EntryAssembly:
using TXTextControl;
public class DocumentService
{
public DocumentService()
{
// The license is compiled into this class library
ServerTextControl.EntryAssembly = typeof(DocumentService).Assembly;
}
public string GetHtml(string text)
{
using (ServerTextControl tx = new ServerTextControl())
{
tx.Create();
tx.Text = text;
string html;
tx.Save(out html, StringStreamType.HTMLFormat);
return html;
}
}
}
The application that calls the library needs no reference to TX Text Control and no license. The same applies to unit test frameworks such as NUnit and MSTest, which run tests from precompiled assemblies.
- Before version 32.0 with Service Pack 2, and with licenses.licx, the license had to be in the executable that calls the library. Dropping a
TextControlon a form of the main project, or adding licenses.licx and the reference there, puts it there. - Do not rename assemblies after they are built. The license is stored in the resources of the assembly and is no longer found under another name.
Features and the Edition
A license covers the features of its edition. Using a feature that is not part of the licensed edition throws a LicenseLevelException. Editions and Feature Availability lists the features of each edition.
What Must Not Ship
Your serial numbers, the license file txtextcontrol.winforms.license and your nuget.config with its API token must never reach your users. Keep Licensing Information Out of the Deployment lists what to check before a release, and Redistribution Overview lists the files your application ships.