TX Text Control .NET for Windows Forms

Migrating From .NET Framework to .NET

Topic

An existing Windows Forms application that uses TX Text Control on the .NET Framework can move to .NET 8 or higher. The TX Text Control code stays the same, but the project changes around it: it references the NuGet package instead of the installed assemblies, and it no longer needs a licenses.licx file. The steps below take you through the move, including class libraries and charts.

What Changes

.NET Framework.NET 8 or higher
Project fileClassic project fileSDK-style project file
TX Text Control filesReferences to the assemblies in the Assembly folder of the installationThe NuGet package TXTextControl.TextControl.WinForms.SDK
Licenselicenses.licx, compiled by the license compilerThe license file of the package, embedded into your assembly
Toolbox itemsCreated by the setupAdded by the package, for the current project
ChartsSystem.Windows.Forms.DataVisualization of the .NET FrameworkA .NET port of the chart control

Before You Start

Convert the Project

.NET Windows Forms projects use SDK-style project files, so the project file has to be converted, and its references and packages added again. Text Control's article on this migration uses the .NET Upgrade Assistant extension for Visual Studio:

  1. Install the .NET Upgrade Assistant extension and open your project.
  2. In Solution Explorer, right-click the project and choose Upgrade.
  3. Select Upgrade project to a newer .NET version, then In-place project upgrade.
  4. Select .NET 8 or higher as the target framework and click Upgrade selection.

The tool does not convert the TX Text Control references. They remain in the project, marked with a warning sign, until you replace them in the next step.

Microsoft has since deprecated the .NET Upgrade Assistant and recommends its GitHub Copilot modernization agent instead. See Upgrade Assistant overview on Microsoft Learn. Whichever tool converts the project, the TX Text Control steps below are the same.

Replace the References With the NuGet Package

  1. Choose Project > Manage NuGet Packages....
  2. Select Text Control Offline Packages as the package source.
  3. Install TXTextControl.TextControl.WinForms.SDK.
  4. Remove the old references to the TX Text Control assemblies, if the tool left them in the project.
  5. In Solution Explorer, delete the file licenses.licx.

The project now compiles and runs on .NET. Installing and Updating Packages describes the package installation in detail.

  • Why licenses.licx goes. The license compiler that reads licenses.licx does not exist in .NET. Since version 32.0 with Service Pack 2, the package adds the license file txtextcontrol.winforms.license to your project, and the build embeds it into your assembly. The file contains encrypted serial number information, so do not share or distribute it. See Development Licenses.
  • The designer. In a .NET project, the toolbox items come from the package, and the Visual Studio designer works as before. See Visual Studio Toolbox and Designer.

Class Libraries

If TX Text Control is used in a class library rather than in the application's executable, set the static property TextControl.EntryAssembly or ServerTextControl.EntryAssembly to the assembly that holds the license. Class Libraries and User Controls shows the code.

Charts

TX Text Control shows charts with the chart control of System.Windows.Forms.DataVisualization. Microsoft did not port this library to .NET. For .NET, Text Control uses a fork of a .NET port, available at github.com/TextControl/winforms-datavisualization:

  1. Clone the repository and build it. The build creates the package System.Windows.Forms.DataVisualization.1.0.0.nupkg.
  2. Copy the package into C:\Program Files (x86)\Text Control GmbH\NuGetPackages, the folder of Text Control Offline Packages.
  3. Install the package in your project from Text Control Offline Packages.

With the package installed, the chart commands of RibbonInsertTab and RibbonChartLayoutTab work, and your code adds charts to TextControl.Charts as before. The blog article Using Charts with TX Text Control .NET for Windows 31.0 in .NET 6 shows the steps with screenshots.

Publish the Application

A .NET application is published with Build > Publish Selection in Visual Studio, and the publish process copies the TX Text Control files. See Publishing .NET Applications.