22

When I am opening a Visual Studio project with VB.NET then the Form view designer is automatically opened, but when I open a new project with C# .NET Core 3.1 with Windows Forms then it is showing code of form1.cs.

I tried to alternate from Solution Explorer as well from menu Viewdesigner option, but it is still not showing a form. What is going wrong there?

I made a Google search for this, but I did not find anything useful on this.

Please check in the image that I'm getting during the opening project.:

Please check in the image that I'm getting during the opening project.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
SRSENT
  • 239
  • 1
  • 2
  • 4
  • 3
    Push `Shift+F7`, which is the shortcut to open the designer. You should also be able to access it using the Solution Explorer on the right-hand side of your VS environment. – Martin Nov 06 '19 at 11:49
  • I tried this as well but code is still there and form is not showing. – SRSENT Nov 06 '19 at 11:52
  • 11
    Are you sure you haven't picked a .Net Core 3 Windows Forms project instead of the .Net Framework one? Core 3 projects don't have the designer, yet. – Jimi Nov 06 '19 at 11:54
  • 1
    The target framework is **.NET Core 3.0** – SRSENT Nov 06 '19 at 11:59
  • 3
    Yep, as already mentioned, you don't have a designer with .Net Core 3. You need the use .Net Framework template for now. You can try the preview version, if you want to test it: [Introducing .NET Core Windows Forms Designer Preview](https://devblogs.microsoft.com/dotnet/introducing-net-core-windows-forms-designer-preview-1/) – Jimi Nov 06 '19 at 12:01
  • Thank you so so much, **Jimi.** I got what I'm doing wrong there. I forget to choose the framework option. There are two options. one Is the core and another is framework option. I must choose the **Windows forms App(.Net Framework)** Not a **Windows forms App(.Net Core)**. That's why I am missing form because core 3 do not have a designer view form option as mentioned by **Jimi**. – SRSENT Nov 06 '19 at 12:19
  • 1
    This article mentions that it is only available for the preview version of Visual Studio 16.6 for .NET Core. https://devblogs.microsoft.com/dotnet/updates-on-net-core-windows-forms-designer/ – Yodacheese Mar 30 '20 at 20:59

2 Answers2

25

Make sure you only have the form declared in your file. If you have more than one class defined, the design viewer will not work.

jman
  • 355
  • 3
  • 8
  • 6
    This helped me, the designer worked fine until I added another class to the same file. It worked again when I removed the new class. – uceumern Jul 02 '20 at 08:07
  • 6
    This was my issue. I had another class in the same file as Form1.cs. When I removed the class, the designer worked again. – DrMaxB Jun 09 '21 at 10:06
  • 2
    Omg, what a nightmare that was. I created an EventArgs class in the same file as the control. VS should issue a warning or something about that. You saved me a LOT of time, no way I would have realized that on my own. – Glaucus Jan 13 '22 at 17:19
  • What a terribly designed IDE – Austin Capobianco Mar 13 '23 at 17:28
  • OMG it is 2023 and they still haven't fixed this, so what if there is a non-Form class in the file, just look for public partial class SomeClass : Form – Gerry May 02 '23 at 20:42
15

Preview Visual Studio 2019 until v16.4 needs a VSIX separate installation extension. Now you can update your Preview of Visual Studio 2019 (to 16.5 or higher) and you don't need this extension. You can do it through the menu "Help" of the Visual Studio IDE.

After the update, go to menu ToolsOptionsEnvironmentPreview Features and check the "Use previews of the .NET Core SDK (requires restart)" option.

Restart Visual Studio and it will work ;)

You can install the Preview Version that will have all these and more feature enabled. As it’s a preview, it may be unstable, but it can run side by side with your normal version in case something is broken in preview.

Visual Studio Preview

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Izar Urdin
  • 326
  • 1
  • 11
  • Alternatively you can type `Preview Features` into the search anything box as opposed to navigating though the menu – Max Carroll Jan 13 '20 at 14:04
  • 1
    I can confirm the issue still happens with vs2019 Community v16.5. Downloaded yesterday, created a form and today cannot open it. any attempt just open a second tab of the **form.cs** code – jean Mar 21 '20 at 12:11
  • Downloaded the VSIX but it says it already installed. In addition, I still don't have that preview option – jean Mar 21 '20 at 12:21
  • 3
    I am on v16.5.2 and still design view is not showing up. – Farhan Apr 04 '20 at 14:49
  • You need to use Visual Studio **Preview** Channel – Piotr Kula Apr 15 '20 at 20:09
  • @PiotrKula what exactly does that mean please? – John Mc Apr 15 '20 at 22:45
  • https://visualstudio.microsoft.com/vs/preview/ – Piotr Kula Apr 16 '20 at 08:59
  • In my case, I had one particular project where form designer didn't show up even though preview feature was enabled. I had tried VS 2019 and VS 2022 with no luck when I **created a new form** as an act of despair. After that designer just mysteriously initialized and started to work for all the forms within the project in both Visual Studios. Hope this info will save some nerves and time for someone. – Vladimir Liubimov Apr 16 '22 at 07:52