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 .\framework_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>
    view raw test.csproj hosted with ❤ by GitHub

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

Migrating the App