.NET 和 VB6 : is Interop a viable development strategy?

标签 .net vb6 interop

VB6 和.NET 之间的互操作是一种可行的开发策略吗?

我正在开发一个与一些 .NET 程序集互操作的 VB6 应用程序,但“冷启动”和其他内聚问题的组合导致了不平滑的结果。

最佳答案

编辑 - 缩小了我的回答范围。
是否可以?是的,当然了。
我会推荐它吗?当然不是!
陈规定型的情况(我遇到过很多次)是您有一些组件是在五年或十年前用 VB6 编写的。作者已离开公司,虽然应用程序解决的问题相当简单且易于理解,但应用程序本身却不是;公司中没有人真正知道如何维护它和/或它写得不好并且一开始就很难维护。
如果您的情况看起来像那样,那么我会推荐一个端口 - 特别是如果您的公司缺乏 VB6 资源并且拥有大量 .NET 资源。正如 MarkJ 所说,这不一定是普遍的意见,但根据我自己的经验,这确实是正确的。
在 MS 帖子上发帖:-
http://msdn.microsoft.com/en-gb/dd408373.aspx#migrate3
MS 表示,从头开始重写通常比扩展或自动迁移(使用链接的工具)成本更高。我当然使用 Visual Basic 升级向导作为起点,尽管我们通常是移植到 C# 而不是 VB.NET。这是一个很好的起点 - 特别是如果您偏爱 VB.NET。
最后:-

Normally we would only recommend [a rewrite] for a small number of situations including:

  • The original application has many problems resulting from bad architecture, design and/or coding practices. Symptoms may include poor scalability or performance, poor user interface and difficulties in maintaining the code.
  • The original application no longer matches the needs of the business in significant areas. A core change is required, e.g. the user interface must be delivered by the browser rather than as a smart client.
  • The company already has significant skills in .NET gained on other applications and the application is well understood and relatively small.
  • Source code is no longer available for significant parts of the application.

这些都是很好的点,但是如果您无法确定项目中的至少一个问题 - 应用程序运行良好且可维护,您需要进行的更改很小,公司拥有大量 VB6 资源,并且您可以访问源代码 - 我可能会问你为什么要迁移到 .NET。在我参与的每个相关项目中,我们都遇到了前三个问题中的两个(如果不是全部三个)。
如果移 Root 本不是一种选择,那么我们需要更多信息。它是什么样的应用程序? VB6 在做什么? .NET 在做什么?

关于.NET 和 VB6 : is Interop a viable development strategy?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4458961/

相关文章:

c# - 无法加载一种或多种请求的类型。检索 LoaderExceptions 属性以获取更多信息。与实体数据源

vba - 拆除循环引用

C# Interop Non-invocable 成员 'Microsoft.Office.Interop.Excel.Range.End' 不能像方法一样使用

c# - 如何使用 WCHAR* out 参数从 C# 调用 C 函数?

c# - WCF OperationContract 属性忘记值

c# - 如何将 sender 参数传递给 system.timers.timer

.net - IAsyncOperation 在 Windows 服务中等待 : "Type is defined in an assembly that is not referenced..."

mysql - 通过 inno setup 使用 mysql 创建 vb6 设置

c# - 单步执行 .NET 类包装的 VB6 COM 对象

c# - 如何在不注册的情况下使用 Win32 中的 .Net 程序集?