From classic to modern: understanding the .NET Frameworks difference when crafting WinForms projects with Visual Studio

From classic to modern: understanding the .NET Frameworks difference when crafting WinForms projects with Visual Studio

·

3 min read

Do you work with the Microsoft .NET Platform and Visual Studio (not VSCode) to build WinForms apps?

I still do. Nothing quite matches the speed and simplicity of crafting a Windows app with a sleek UI using Windows Forms.

Haven't done this in a while, and I wanted to try something that required a user interface (UI). So, I downloaded Visual Studio (Community edition 2022, the latest at the time of writing this article) and clicked on "Create new project." I chose the language (C#) and platform (Windows). Suddenly, I saw two very similar options:

  • Windows Forms App

  • Windows Forms App (.NET Framework)

I thought, "Uh, why do I have two options?"

Then it hit me — since 2016, there have been two different versions of the .NET Platform:

  1. .NET Framework - the traditional, Windows-only version known as ".NET Framework 1.x / 2.x / 3.x / 4.x."

  2. .NET - the cross-platform .NET (Core) versions, like 5 / 6 / 7 / 8

The .NET Framework is the first generation of the software development platform by Microsoft that provides a comprehensive and consistent programming model for building Windows (-centric) applications, Web applications and services.

The .NET is the successor of the .NET Framework, that is cross-platform (allows development for Windows, Linux and macOS) with enhanced performance and a new and regular release cadence.

This was confirmed by the project creation configuration screen:

  1. The "Windows Forms App (.NET Framework)" option includes a .NET Framework version selection

  2. The "Windows Forms App" option includes a .NET version selection

A quick check of the project configuration file ( csproj) reveals distinctly different configurations as well:

  1. The configuration for .NET Framework is quite long and extensive

  2. In contrast, the configuration for .NET is very short and, as expected, specifically targets the .NET platform.

This difference is crucial because there are still external libraries and components exclusively available for the .NET Framework. If you create a project under the wrong configuration without checking, these libraries won't function as expected in a .NET project.

For additional information about the .NET Framework, you can explore the documentation on Microsoft Learn here (https://learn.microsoft.com/en-us/dotnet/framework/) and in this overview (https://learn.microsoft.com/en-us/dotnet/framework/get-started/overview). To download the .NET Framework, visit the official download page (https://dotnet.microsoft.com/en-us/download/dotnet-framework).

For additional information on .NET, you can find more details here (https://dotnet.microsoft.com/en-us/). To download the latest version, visit this page (https://dotnet.microsoft.com/en-us/download/dotnet).

That wraps up this article, and I hope you find this information helpful.
Whether you're using the traditional ".NET Framework" or the modern ".NET," grasping these details is crucial for crafting WinForms projects in Visual Studio. If you have more questions or thoughts, don't hesitate to reach out.

Enjoy coding in the ever-changing world of .NET development!

Did you find this article valuable?

Support Pavel by becoming a sponsor. Any amount is appreciated!