简体   繁体   English

无法将自定义 ActiveX 控件添加到 .NET Core WinForms 应用程序,但 .NET Framework 应用程序工作正常

[英]Can't add custom ActiveX control to .NET Core WinForms app., but .NET Framework app works fine

We make a C++ ActiveX control for years now.多年来,我们一直在制作 C++ ActiveX 控件。 It's now built using VS 2019.它现在是使用 VS 2019 构建的。
When I create a new .NET Framework v4.8 WinForms project I can add my ActiveX control to the toolbox in VS2019 and drop it on my form.当我创建一个新的 .NET Framework v4.8 WinForms 项目时,我可以将我的 ActiveX 控件添加到 VS2019 的工具箱中并将其拖放到我的表单上。

But when I create a new .NET 5 WinForms project using VS2019 or a new .NET 6 WinForms project using VS2022 I can look up the ActiveX control when using Choose Items .. but when I select the control I get this error:但是,当我使用 VS2019 创建新的 .NET 5 WinForms 项目或使用 VS2022 创建新的 .NET 6 WinForms 项目时,我可以在使用Choose Items ..但是当我选择控件时,我收到此错误:

The following controls were successfully added to the toolbox but are not enabled in the active designer

Make sure the controls to add are compatible with the current designer and .NET Framework version

I can however create the control using code in the designer and at run-time, the application works as expected.但是,我可以在设计器中使用代码创建控件,并且在运行时,应用程序按预期工作。 I can't open the form in design time, that will generate an error.我无法在设计时打开表单,这会产生错误。

Most likely I need to update my ActiveX control to make it more compatible with .NET Core, but I can't find what.很可能我需要更新我的 ActiveX 控件以使其与 .NET Core 更兼容,但我找不到什么。

Can anybody offer advice?有人可以提供建议吗?

It seems this is by design.看来这是设计使然。 Microsoft decided to not put back the ability to use ActiveX controls in the Forms designer when using .NET. Microsoft 决定在使用 .NET 时不恢复在窗体设计器中使用 ActiveX 控件的能力。

When you need this, you can vote for it on https://developercommunity.visualstudio.com/t/support-for-activex-controls-in-windows-forms-desi/1435698 and perhaps before the end of the century, it will be implemented.当你需要这个时,你可以在https://developercommunity.visualstudio.com/t/support-for-activex-controls-in-windows-forms-desi/1435698上投票,也许在世纪末之前,它将实施。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 中的 .net 核心适用于控制台应用程序,但不适用于 wpf 或 winforms - .net core in visual studio works with console app but not with wpf or winforms 无法调用/加载.NET Core程序集,但.NET Standard在PowerShell中使用Add-Type可以正常工作 - Can't call/load .NET Core assembly but .NET Standard works fine using Add-Type in PowerShell 将.NET Framework与Winforms应用程序捆绑在一起 - Bundling .NET Framework with Winforms app 在VS2013 Professional for C#WinForms应用程序上使用Visual Studio Installer。 使用.NET Framework安装创建安装 - Using Visual Studio Installer on VS2013 Professional for C# WinForms app. create Installation with .NET Framework installation included 从WinForms应用程序检查.Net框架版本 - Check on .Net framework version from WinForms app .NET Core Web应用程序可以使用.NET Framework类库吗? - Can a .NET Core Web app consume .NET Framework class libraries? 发布。 NET核心Web应用程序。 在Windows和Linux中 - Publish. NET core Web App. In window and linux .net 核心无法作为独立应用程序运行。 在 docker - .net core Failed to run as a self-contained app. on a docker 在 .NET 框架上运行 .NET 核心应用程序 - Running .NET core App on .NET framework 将 .Net Framework 应用程序与 .Net Core 库混合使用 - Mixing .Net Framework app with .Net Core library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM