Can't Open Form [Design] View in WinForms Project

How to fix Visual Studio projects that are unable to open Form Designer.

Have you ever been developing a WinForms project and encountered a situation where you couldn’t use the View Designer?

This problem can occur when you’re using the latest SDK-style project but are still targeting an older version of .NET, such as 4.8 or below.

Rest assured, you’re not alone.

The solution is rather straightforward.

In Visual Studio, simply right-click on your project file and select Edit Project File.

Now, you just need to include a new ItemGroup for your Form files.

For instance, if you have a MainForm in your root folder, you can add the item like this:

<Project Sdk="Microsoft.NET.Sdk">

  <!-- ... -->

  <ItemGroup>
    <Compile Update="MainForm.cs">
      <SubType>Form</SubType>
    </Compile>
  </ItemGroup>
  
  <!-- ... -->

</Project>

Or if you have a lot of Forms and all of their names end with Form.cs such as MainForm.cs, AboutForm.cs, etc. You can change it like this:

<Project Sdk="Microsoft.NET.Sdk">

  <!-- ... -->

  <ItemGroup>
    <Compile Update="**\*Form.cs">
      <SubType>Form</SubType>
    </Compile>
  </ItemGroup>
  
  <!-- ... -->

</Project>

And that’s it! You can now use your Form designer again.