.net - 我的 .NET 2.0 应用程序将继续工作多久?

标签 .net winapi

每个版本的 Microsoft .NET 框架都有 a limited support lifetime ,例如:

  • 对 .NET Framework 1.1 的支持于 2005 年 9 月 9 日结束
  • 对 .NET Framework 2.0 的支持于 2010 年 1 月 12 日结束
  • 对 .NET Framework 3.0 的支持于 2011 年 7 月 12 日结束

  • 我拥有 an application from 2004这是用 .NET Framework 1.1 编写的。如果您尝试在现代 Windows 7 64 位计算机上安装 .NET Framework 1.1 版,您将收到错误消息 - 它无法正常工作。 2006 年编写的程序不再可用;你不妨把它扔掉。

    这是否意味着我在 中编写的程序.NET 3.5 今天,在 future 的某个时候,会无法使用吗?

    Microsoft went to great lengths with the Windows API to maintain backwards compatibility. A program written 18 years ago (for Win32 or Win32s) will still run on Windows of today. (I know - I own one. It originally ran on Windows 3.1 and still runs on Windows 7 64-bit.)



    我今天编写的本地程序在 18 年后仍然可以运行(可能)。但似乎我今天编写的 .NET 程序不能保证它会继续运行。

    Microsoft 是否有任何关于 .NET Framework 2.0 或更高版本的兼容性 promise ?我知道 .NET 框架 1/1.1 是一个丑陋的继子; .NET 框架 2.0 破坏了与 1.1 的兼容性;但自 2.0 以来的每个框架都与 2.0 兼容。

    是否有说明如果我使用 .NET 2.0 或更高版本编写托管应用程序,它应该继续在 Windows 8、Windows 9、Windows 10 等上运行?

    .NET Framework 1.1 错误案例

    使用 Process Explorer 监视程序,我发现了它正在尝试创建的 .NET 对象,但失败了:

    enter image description here

    它的类:
  • clsid:{60EBA0BC-D6AF-41C2-9584-D48D3DA39999}
  • 程序:Engine.Factory

  • 所以我创建了一个小测试应用程序来查看 可以创建相同的 COM 对象:
    const Guid CLSID_EngineFactory = '{60EBA0BC-D6AF-41C2-9584-D48D3DA39999}';
    
    IUnknown unk = CoCreateIntance(CLSID_EngineFactory, null, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IUnknown);
    

    这对我来说也失败了。我在注册表中找到了注册详细信息:
    HKEY_CLASSES_ROOT\Wow6432Node\CLSID
       {60EBA0BC-D6AF-41C2-9584-D48D3DA39999}
          InprocServer32
                (Default)       mscoree.dll
                Assembly        mcengr, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
                Class           Engine.Factory
                RuntimeVersion  v1.1.4322
                ThreadingModel  Both
    

    如果程序应该在安装了 .NET framework 4 的情况下运行,那么我想我可以责怪应用程序的安装程序。

    这很可能是我问题的答案:
  • 虽然不再支持 .NET Framework 1.1,
  • .NET Framework 1.1 仍受支持

  • 我只是假设这两种说法不可能同时成立。

    最佳答案

    大多数 .NET 1.1 程序应该可以在 .NET 2 甚至 .NET 4 运行时上正常工作。该框架具有代替运行旧版本的能力。唯一的异常(exception)是如果应用程序使用了框架版本之间发生变化的东西(所谓的重大变化)。
    话虽如此,我不明白为什么 .NET 2 不受 .NET 3 和 3.5 支持,因为 3 和 3.5 是 .NET 2 的超集。
    所以答案是,您的应用程序应该在 future 很长一段时间内继续工作,除非您碰巧有一些依赖于重大更改的代码。
    来自马口,Version Compatibility in the .NET Framework (MSDN):

    The .NET Framework 4 is backward-compatible with applications that were built with the .NET Framework versions 1.1, 2.0, 3.0, and 3.5. In other words, applications and components built with previous versions of the .NET Framework will work on the .NET Framework 4.

    However, in practice, this compatibility can be broken by seemingly inconsequential changes in the .NET Framework and changes in programming techniques. For example, performance improvements in the .NET Framework 4 can expose a race condition that did not occur on earlier versions. Similarly, using a hard-coded path to .NET Framework assemblies, performing an equality comparison with a particular version of the .NET Framework, and getting the value of a private field by using reflection are not backward-compatible practices. In addition, each version of the .NET Framework includes bug fixes and security-related changes that can affect the compatibility of some applications and components.

    关于.net - 我的 .NET 2.0 应用程序将继续工作多久?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9539941/

    相关文章:

    c# - C# 编译器是否足够智能来优化此代码?

    .net - 我什么时候应该使用结构?

    wpf - 在混合 wpf/win32 应用程序中定义应用程序范围的热键

    c++ - 跨进程 PostMessage、UIPI 限制和 UIAccess=”true”

    c++ - 特定窗口c++的屏幕截图

    c# - 基本的二维图形库

    c# - 如何设置测试TCP连接超时?

    .net - 不匹配确切单词的正则表达式

    windows - FASM 汇编程序在退出前等待

    c++ - 使用 DeviceIoControl 函数读取 MBR 时出现问题