Migrating From .NET Framework to .NET
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 file | Classic project file | SDK-style project file |
| TX Text Control files | References to the assemblies in the Assembly folder of the installation | The NuGet package TXTextControl.TextControl.WinForms.SDK |
| License | licenses.licx, compiled by the license compiler | The license file of the package, embedded into your assembly |
| Toolbox items | Created by the setup | Added by the package, for the current project |
| Charts | System.Windows.Forms.DataVisualization of the .NET Framework | A .NET port of the chart control |
Before You Start
- Install the setup of TX Text Control .NET for Windows Forms 34.0 on your development machine. It provides the NuGet package in the source Text Control Offline Packages. See Installing the Product.
- If the application uses an earlier TX Text Control version, read Upgrading from Previous Versions and Breaking Changes as well.
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:
- Install the .NET Upgrade Assistant extension and open your project.
- In Solution Explorer, right-click the project and choose Upgrade.
- Select Upgrade project to a newer .NET version, then In-place project upgrade.
- 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
- Choose Project > Manage NuGet Packages....
- Select Text Control Offline Packages as the package source.
- Install
TXTextControl.TextControl.WinForms.SDK. - Remove the old references to the TX Text Control assemblies, if the tool left them in the project.
- 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:
- Clone the repository and build it. The build creates the package System.Windows.Forms.DataVisualization.1.0.0.nupkg.
- Copy the package into C:\Program Files (x86)\Text Control GmbH\NuGetPackages, the folder of Text Control Offline Packages.
- 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.