1

Just like how we right click on the project and would be able to add Windows Form in the .NET Framework console application, is it possible to add Windows Form in .NET Core console application?

.NET Framework console application

.NET Core console application

joekevinrayan96
  • 564
  • 10
  • 25
  • 1
    Do it the other way round. Create a winforms application and open a console: [How do I show a console output/window in a forms application?How do I show a console output/window in a forms application?](https://stackoverflow.com/q/4362111/880990). – Olivier Jacot-Descombes Jul 28 '21 at 15:10
  • 2
    It might be easier to add console app functionality to a winforms project. – abdusco Jul 28 '21 at 15:10
  • @OlivierJacot-Descombes but I'm given the console application where I will have to work with. Even if I change the output type in the project properties back to the windows application I couldn't find the option to add windows form. Will I have to make any changes adding library or anything? – joekevinrayan96 Jul 28 '21 at 15:39
  • 1
    Create a .net 5 winforms app and you will see the dependencies it adds to the project. Also inspect the .csproj file to see the required settings (`WinExe net5.0-windows`). Also, the main routine must be `[STAThread]`. – Olivier Jacot-Descombes Jul 28 '21 at 16:10

2 Answers2

0

Create a .net core winform project, compile, manually reference System.Windows.Forms.dll and System.Drawing.Common.dll into the project, then use [STAThread] for the Main function, it works for me.

Tpm13
  • 1
  • 1
0

NuGet manager, Install-Package System.Configuration.ConfigurationManager

Z.R.T.
  • 1,543
  • 12
  • 15