Visual Studio 2017 - Cannot Find Visual C ++ Windows Forms

So, I'm in an uncomfortable situation - I wanted to create a Windows Form application using Visual Studio, but I can not find a place to create a Windows Form Visual C ++ template. I even tried reinstalling Visual C ++, adding other libraries, and doing an Internet search - no results.

I can, of course, create new Winforms in C #:

enter image description here

But not in C ++:

enter image description here

All possible modules in Visual Studio Update were also tested:

enter image description here

I even tried adding a template from the Online list:

enter image description here

What should I do next? I am using Visual Studio 2017 Community Edition.

+5
source share
2 answers

Ok, I found a working way to create Windows Forms in Visual Studio 2017.

  • Create a new empty CLR project:

enter image description here

  1. Add a .cpp file for the main function.

  2. In the project, add a new element from UI-> Windows Forms:

enter image description here

(If we did not add the main loop before the error occurred)

  1. Now we can add new elements to create from the toolbar to the left (I took the time to measure this).

enter image description here

  1. To run the application, we must declare this instead of the main function:

enter image description here

We also need to tell Visual Studio that we are making a Windows application instead of a console application:

enter image description here

+7
source

WinForms constructor support for C ++ / CLI was removed a long time ago in VS 2012. MS suggests using C # for your WinForms code and use only C ++ / CLI if you need to interact with native code.

And if you end up using C ++ / CLI for interaction, keep this layer as small as possible. He is a second-class citizen in the .NET world and is not even mentioned by Microsoft in a recent post about his language strategy.

+2
source

Source: https://habr.com/ru/post/1269237/


All Articles