3

In a .NET 5 application I can use WinForms so I can use this controls, but I would like to migrate to .NET 6, but I don't see the way to use WinForms controls.

I don't know if it is possible, or if it would be possible to use another file browser in my WPF .NET 6 application.

wonea
  • 4,783
  • 17
  • 86
  • 139
Álvaro García
  • 18,114
  • 30
  • 102
  • 193
  • What does ` I don't see the way to use win forms controls` mean? How did you use WinForms controls in .NET 5? Both are .NET *Core* so what worked with .NET (Core) 5 should work with .NET (Core) 6 as well – Panagiotis Kanavos Nov 11 '21 at 15:46
  • In Net 5 (or in visual studio 2019) I can mark the option to use win forms. However I don't see this option in Net 6 and visual studio 2022. – Álvaro García Nov 11 '21 at 15:47
  • .NET 5 doesn't require a specific IDE. The source files and the `csproj` file can be edited using any editor. If you have to, you can copy the settings from the old project. Besides, you don't even need that setting. Even in .NET Framework all you have to do is [add a reference to System.Windows.Forms and use the class](https://stackoverflow.com/questions/4547320/using-folderbrowserdialog-in-wpf-application) – Panagiotis Kanavos Nov 11 '21 at 15:51
  • Thanks, it works if I add to the .project file "true" – Álvaro García Nov 11 '21 at 15:58

1 Answers1

8

.NET 5 and .NET 6 are still .NET Core and don't require a specific IDE to compile. Project settings are stored in the csproj file and can be edited even with any text editor.

You can inspect the contents of the .NET 5 project and copy any settings you need to the .NET 6 project. Or you can simply change the project's target from net5.0 to net6.0.

In this case the setting is

<UseWindowsForms>true</UseWindowsForms>
Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236