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:

 1<Project Sdk="Microsoft.NET.Sdk">
 2
 3  <!-- ... -->
 4
 5  <ItemGroup>
 6    <Compile Update="MainForm.cs">
 7      <SubType>Form</SubType>
 8    </Compile>
 9  </ItemGroup>
10  
11  <!-- ... -->
12
13</Project>
MyProject.csproj

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:

 1<Project Sdk="Microsoft.NET.Sdk">
 2
 3  <!-- ... -->
 4
 5  <ItemGroup>
 6    <Compile Update="**\*Form.cs">
 7      <SubType>Form</SubType>
 8    </Compile>
 9  </ItemGroup>
10  
11  <!-- ... -->
12
13</Project>
MyProject.csproj

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