question

BryanKelly-4107 avatar image
1 Vote"
BryanKelly-4107 asked MinxinYu-MSFT answered

Configure for Windows Forms

Windows 11, just installed and still having problems. Visual Studio 2019
The goal is to create a GUI project using Windows Forms. A couple of web sites and tutorials indicate that the starting project should be CLR, Common Language Runtime in case I have that wrong.
Start VS -> Create a new project. Near the top the following three items are selected: C++, Windows, Desktop. In the selection for project type, there are five options:
Windows Desktop Wizard
Windows Desktop Application
Shared Items Project
ATL Project
Makefile Project
And no others.
CLR is not found.
Near the bottom click on Install more tools and features
Among all the options .NET desktop development is checked. I am pretty sure that was included during the original installation. Same for Desktop development with C++. Scroll down and there are no options for CLR. There is nothing in the list that I see a need for.
What have I missed? What must be done to start a Windows Form project?

c++windows-forms
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If you want to do a WinForm project, choose a C# "Windows Forms App" - from the filters in the "Create a new project" window, choose C#, Windows, Desktop.

2 Votes 2 ·
RLWA32-6355 avatar image
1 Vote"
RLWA32-6355 answered

Microsoft removed the templates to create Windows Forms Applications from Visual Studio using C++/CLI from all versions after VS2010. The view was that C++/CLI was intended to facilitate interop between managed code (C#, VB.net) and unmanaged C++.

Microsoft has not devoted the attention or development efforts to C++/CLI similar to what has been done for C#.

I agree with @DavidLowndes-6766 recommendation to use C# for a Windows Forms Application. However, if you wish to use C++/CLI and the various workarounds for Windows Forms then set your New Project filters to C++ | Windows | Console. If you did install the support for CLR then you should see the related projects

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MinxinYu-MSFT avatar image
0 Votes"
MinxinYu-MSFT answered

Hi, @BryanKelly-4107
Check the option in Visual Studio Installer:
214497-image.png

For your reference: .NET programming with C++/CLI


Best regards,

Minxin Yu


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (20.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.