Form can't be opened in designer Visual Studio 2015 (Using C#)

14,543

Solution 1

Check your Form1.Designer.cs and Form1.cs files to make sure you haven't put another class in at the top of the file before your partial class Form1{ because the designer will only load if the Form class is the first class defined in the file.

You mentioned this solution as a comment to one of the answers but I tried performing the edits on the .csproj first before realizing that my changes were being reverted and I needed to remove the myCustomPropertyView class I'd lazily added to the top of the file.

Visual Studio was still acting a bit weird (telling me I had errors on lines which were fully commented out) but once I closed and re-opened Visual Studio I was back up and running.

Solution 2

Try this:

1) Right Click on Solution Explorer.

2) Go to the file that does not have Designer View.

3) Exclude It From Project.

4) Include It From Project.

It worked for me

Solution 3

I think this will be a problem with your project file (.csproj). If you open it in a text editor it is just an XML file that can (but in most cases shouldn't) be edited. There are multiple <ItemGroup> nodes. One has a sub node that (possibly) looks like this:

<Compile Include="Form1.cs" />

Replace it with:

<Compile Include="Form1.cs">
  <SubType>Form</SubType>
</Compile>

EDIT:

There should also be these two nodes:

<Compile Include="Form1.Designer.cs">
  <DependentUpon>Form1.cs</DependentUpon>
</Compile>

<EmbeddedResource Include="Form1.resx">
  <DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>

Solution 4

Recently, a Windows Forms was released that works with .Net Core 3.0

The Designer for that form isn't included in the Visual Studio bundle. So if you want to open the designer for the .Net Core version of windows forms, you need to install a VSIX extension before it is possible. You can download the extension here: https://aka.ms/winforms-designer

I don't know if this extension works specifically with vs15, so if you can't install it, try using a winforms version that isn't the .Net Core one.

source of my info: https://devblogs.microsoft.com/dotnet/introducing-net-core-windows-forms-designer-preview-1/

Solution 5

Try restarting Visual Studio, rebuilding solution, and running it

Share:
14,543
Sam Wrayn
Author by

Sam Wrayn

Updated on June 09, 2022

Comments