Products Technologies Demo Docs Blog Support Company

This blog post contains outdated information.

The cited code snippets may be workarounds, and be part of the official API in the meantime.

Migrate a Windows Forms Desktop Application to .NET 6

This article shows how to migrate a .NET Framework Windows Forms desktop application to .NET 5 and better using the .NET Upgrade Assistant. This command line tool helps to migrate the complete project, but minor tweaks are required to port TX Text Control over to .NET 5 and 6.

Migrate a Windows Forms Desktop Application to .NET 6

Since .NET 5, Windows Forms (and WPF) desktop applications can be created in Visual Studio based on the new SDK-style project files. Converting existing .NET Framework projects can be a complex task as not only a complete new project file is required, but existing NuGet packages and existing references need to be re-added.

The .NET Upgrade Assistant is a command-line tool that helps with this task and is designed to assist in upgrading existing .NET Framework projects to .NET 5 and better.

Installing the .NET Upgrade Assistant

The tool can be easily installed as a .NET CLI tool by running the following command in a Windows Terminal:

dotnet tool install -g upgrade-assistant

Running the Upgrade Process

Open a Windows Terminal and navigate to the folder where your target project is located. Run the upgrade-assistant command by passing the project name:

upgrade-assistant upgrade .ramework_app_wf.csproj

The migration tool guides you through the migration process:

Migrating the App

After each step, the tool provides you an option list to apply or skip the separate, required steps. Simply apply each step for each project in your solution.

In the last step, the project is finalized and should return with Upgrade has completed. Please review any changes.:

Migrating the App

Updating the References

The .NET Upgrade Assistant is not able to update the TX Text Control project references. In order to re-add these references, follow the next steps.

  • Open the project in Visual Studio and select Add Project Reference... from the Project main menu.
  • Click Browse and navigate to the TX Text Control installation folder and select the TX Text Control assemblies you would like to include.

    Migrating the App

  • Find the licenses.licx and make sure that the Build Action is set to Embedded Resource.

  • Select the project in the Solution Explorer and select Edit Project File from the Project main menu. Find the PropertyGroup node and add the EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization property, so that the complete group looks like this:

    <PropertyGroup>
      <TargetFramework>net6.0-windows</TargetFramework>
      <OutputType>WinExe</OutputType>
      <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
      <UseWindowsForms>true</UseWindowsForms>
      <ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
      <EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization>true</EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization>
    </PropertyGroup>

The project is now completely converted, can be compiled and started:

Migrating the App

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Windows Forms

Text Control combines the power of a reporting tool and an easy-to-use WYSIWYG word processor - fully programmable and embeddable in your Windows Forms application. TX Text Control .NET for Windows Forms is a royalty-free, fully programmable rich edit control that offers developers a broad range of word processing features in a reusable component for Visual Studio.

See Windows Forms products

Related Posts

Windows FormsWPF.NET 6

Windows Forms and WPF Comeback: .NET 6 and 7. Our Commitment to Windows…

Windows Forms was introduced in the first version of .NET and Visual Studio in 2001. Since then it has grown in popularity specifically for rapid, WYSIWYG development. With the release of .NET…


ASP.NETWindows FormsWPF

Visual Studio 2022 and .NET 5, 6 and 7 (Preview) Support and Strategy

With the release of TX Text Control 31.0, we will fully support .NET 5, 6 and 7 (Preview) within Visual Studio 2022 including Windows Forms designer support, NuGet packages and deployment support.


ASP.NETWindows FormsWPF

Sneak Peek 31.0: Signature Fields

In TX Text Control 31.0, we will introduce native signature fields that can be used to add electronic and digital signatures to documents. These new fields will be compatible to the ASP.NET…


ASP.NETWindows FormsWPF

Sneak Peek 31.0: Full .NET 6 Visual Studio Designer Support

The next version 31.0 is in the works and for .NET Windows Forms and WPF, we are working on enhancements to fully support .NET 6 features including Visual Studio design-time support, NuGet…


ASP.NETWindows FormsWPF

TX Text Control 33.0 SP3 is Now Available: What's New in the Latest Version

TX Text Control 33.0 Service Pack 3 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…