激活.Net Core 3.1中缺少的Winforms控件 [英] Activate missing Winforms controls in .Net Core 3.1

查看:108
本文介绍了激活.Net Core 3.1中缺少的Winforms控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Winforms .Net Framework应用程序迁移到了.net Core 3.1,但是工具箱中缺少某些控件,例如DataGridView.

I migrated my winforms .Net Framework application to .net Core 3.1, but some controls are missing in the toolbox like DataGridView.

有一种方法可以激活那些缺少的控件,因为Microsoft打算稍后对其进行支持.

Is there a way to activate those missing controls as Microsoft intends to support them later.

推荐答案

我们知道,带有.Net Core 3.1的Microsoft Visual Studio Preview 2缺少某些Winforms控件,例如DataGridView和其他控件.Microsoft计划很快支持缺少的控件.

We know that Microsoft Visual Studio Preview 2 with .Net Core 3.1 is missing some Winforms controls like DataGridView, and others. Microsoft is planning to support the missing controls soon.

这个简单的技巧可以轻松激活所有缺少的控件,以启动Winforms .Net Core 3.1

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.

.Net Framework 4.8和.net Core 3.1为我确认了该解决方案.

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

,其步骤如下:1-创建您的winofrms .Net Core项目.2-按project_name.csproj并更改它:

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

    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>

到这个新的:

    <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>

3-然后打开Program.cs并对此进行注释

3- Then open Program.cs and comment this

Application.SetHighDpiMode(HighDpiMode.SystemAware);

要这样:

//Application.SetHighDpiMode(HighDpiMode.SystemAware);

此解决方案将添加所有控件.只需关闭解决方案然后重新打开即可.

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

4-完成应用程序后,只需将所有内容更改为默认值,如下所示:

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

按下project_name.csproj并进行以下更改:

Press on project_name.csproj and change this:

    <TargetFrameworks>netcoreapp3.1</TargetFrameworks>

对于program.cs注释,即使我回滚为默认值,应用程序也会在此行中显示错误,因此我将其保留为注释状态

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

感谢Kirsan

这不是一个问题,它是一个有帮助的帖子.因此,请无需提供答案.非常感谢您的评论.

This is not a question, It is a helping post. So please no need to provide answers. Your comments are highly appreciated.

这篇关于激活.Net Core 3.1中缺少的Winforms控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆