How do I compile a simple WinForms C# application for .NET Framework 2.0 in Visual Studio 2005 or 2019?


I need to create a very simple WinForms C# application that only requires .NET Framework 2.0 to execute properly (due to the fact that the customer isn’t allowed to upgrade or connect his computer to the Internet).

On my computer I have Visual Studio (VS) 2005 and VS2019 installed.

  1. I first tried VS2005 and created an empty WinForms application and sprinkled the project file with <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> tags and compiled.
  2. I then checked the .exe-file inside JetBrains dotPeek (according to a tip I found on How to find out which version of the .NET Framework an executable needs to run?) but it says it’s .NET 3.5 application.
  3. I then tried with VS2019, but I didn’t have to manipulate the project file manually, instead I used the user-friendly dropdown for selecting target framework and set it to 2.0. However, the result was the same, the application became a .NET 3.5 application.

Does anybody know what I’m doing wrong?

Source: Visual Studio Questions