Does Winforms (.NET Core 3) support all .NET Framework controls

前端 未结 2 988
南旧
南旧 2021-01-19 15:27

We have just moved to .NET and we are trying to recreate one of our old projects with C#/.NET, we have heard that .NET Core is the way to go for new projects and we are very

2条回答
  •  Happy的楠姐
    2021-01-19 16:02

    This simple trick can easily activate all the missing controls to start your Winforms .Net Core 3.1

    Before you do these steps, just know that is only confirmed for testing, and not for production yet. one It is confirmed for final production application, I will update the post.

    this solution is confirmed for me with .Net Framework 4.8 and .net Core 3.1.

    with some steps as following: 1- Create your winofrms .Net Core project. 2- Press on project_name.csproj and change this:

        netcoreapp3.1
    

    to this new one:

        net48;netcoreapp3.1
    

    3- Then open Program.cs and comment this

    Application.SetHighDpiMode(HighDpiMode.SystemAware);

    To be like this:

    //Application.SetHighDpiMode(HighDpiMode.SystemAware);

    this solution will add all the controls. just close the solution and reopen.

    4- After you finish your application, just change everything to default again like this:

    Press on project_name.csproj and change this:

        netcoreapp3.1
    

    For the program.cs uncomment, even after I rolled back to default, the application give an error for this line, so I keep it commented

    Thanks goes for Kirsan

    https://devblogs.microsoft.com/dotnet/updates-to-net-core-windows-forms-designer-in-visual-studio-16-5-preview-1/#comment-4562

提交回复
热议问题