Answer the question
In order to leave comments, you need to log in
How to connect System.Windows.Forms in .Net 5 Console Application?
Good afternoon, I transferred the application from 4.7.2 to .Net 5, it was possible to use the OpenFileDialog class from System.Windows.Forms, the connection to using did not work, I tried to put Microsoft.Windows.Compatibility from NuGet, but it was also empty there. I googled a couple of options with a change to both net5.0-windows and WinExe, respectively, but it didn’t help, the Output Type of the application changed to Windows Application and it did not start
Answer the question
In order to leave comments, you need to log in
Right click on Links->Add Link->Find System.Windows.Forms ->Checking the box doesn't help?
This is how csproj creates .net cli when you dodotnet new winforms
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
</Project>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question