c# - Visual Studio - Windows 8.1 或更低版本用户的 .NET Framework 4.6.1 问题

标签 c# .net vb.net visual-studio visual-studio-2015

tl;dr - 它只会在 Windows 10 之前的任何版本上打开、显示/执行任何内容并关闭,因为它在 Windows 10 上运行得非常好。

亲自测试一下:https://dl.dropboxusercontent.com/s/krxhh1515u7wmfn/PRAGMA.exe?dl=1

在 Windows 10 上工作: 1

不适用于 Windows 10 之前的任何操作系统:

(这显示我是否使启动表单不是 4.6.1 中包含新方法/函数的表单,然后使用 {MainForm}.Show() 调用包含新方法/函数的表单) 2 (Windows 8.1 也是:/image/Jfxrk.png)

我有一个用VB.NET制作的程序,它使用.NET Framework 4.6.1,因为我认为它的问题最少,但我错了,如果Windows 7/8/8.1 上的任何人尝试运行我的应用程序时都不会加载任何内容,因为它仅使用 .NET Framework 4.6.1 上的某些功能。

我可以确认这是因为使用 .NET Framework 4.6.1 就好像我在 .NET Framework 4.6.1 中加载了一个表单,而 .NET Framework 4.6.1 中没有新功能,那么它加载得很好,但是如果我加载具有诸如 .ToUnixTimeInMilliseconds() 之类的函数的表单,它会加载、显示和执行任何内容,然后关闭。我知道它至少加载了一些东西,因为当我打开它时,您可以看到窗口焦点消失,比如说 Windows 资源管理器到刚刚打开的应用程序,但根本没有执行或显示它最终关闭(我假设)因为我在任务管理器中找不到任何相关进程。

这应该不是问题,Windows 7/8/8.1 可以安装 .NET Framework 4.6.1 那么为什么它不能在 Windows 7/8/8.1 上加载?

有没有人意识到这个问题,因为我在谷歌上搜索了很长时间,但没有出现任何相关的内容。我是否遗漏了一些明显的东西?

最佳答案

您引用了未安装的 ActiveX 组件0x80040154 (REGDB_E_CLASSNOTREG)

Exception object: 02499020
Exception type:   System.Runtime.InteropServices.COMException
Message:          Klasse nicht registriert (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
InnerException:   <none>
StackTrace (generated):
    SP       IP       Function
    00000000 00000001 System_Windows_Forms_ni!System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(System.Guid ByRef, System.Object, Int32, System.Guid ByRef)+0x2
    0037E2A0 6B2B0992 System_Windows_Forms_ni!System.Windows.Forms.AxHost.CreateWithLicense(System.String, System.Guid)+0xc2
    0037E2EC 6B2B0A86 System_Windows_Forms_ni!System.Windows.Forms.AxHost.CreateInstanceCore(System.Guid)+0x2e
    0037E320 6B2B0A45 System_Windows_Forms_ni!System.Windows.Forms.AxHost.CreateInstance()+0x99
    0037E348 6B2B1D63 System_Windows_Forms_ni!System.Windows.Forms.AxHost.GetOcxCreate()+0x17
    0037E354 6B2AEE74 System_Windows_Forms_ni!System.Windows.Forms.AxHost.TransitionUpTo(Int32)+0xc0
    0037E3A0 6B2AE08A System_Windows_Forms_ni!System.Windows.Forms.AxHost.CreateHandle()+0x2a
    0037E3C0 6ACDD215 System_Windows_Forms_ni!System.Windows.Forms.Control.CreateControl(Boolean)+0x75
    0037E3FC 6ACDD2E8 System_Windows_Forms_ni!System.Windows.Forms.Control.CreateControl(Boolean)+0x148
    0037E438 6B2AC785 System_Windows_Forms_ni!System.Windows.Forms.AxHost.EndInit()+0x2d
    0037E444 001E50D2 PRAGMA!PRAGMA.Pragma.InitializeComponent()+0x3a62
    0037EC70 001E0F58 PRAGMA!PRAGMA.Pragma..ctor()+0x1b0

关于c# - Visual Studio - Windows 8.1 或更低版本用户的 .NET Framework 4.6.1 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36806918/

相关文章:

c# - 使用NuGet软件包管理器控制台为C#安装EMGU OpenCV

javascript - 修复了导航栏在回发时消失的问题

.net - 空对象上的 SyncLock

vb.net - 检查数组中每个文本框的标签

c# - 如何在 VS 2008 或使用 Coderush Express 中自动生成方法 stub ?

c# - C# 中三角函数的 Math.net 幂

c# - 如何在 ASP.NET Core MVC 中请求并显示实时 Web api 数据?

c# - 如何比较日期时间的时间部分

c# - 如何在 WinForms 中实现这种窗口样式?

c# - 如何在 C# 中将小数舍入为特定分数?