更改 vb.net 的目标 cpu 是否会破坏二进制兼容性?
就像标题所说,如果我更改 vb.net 程序集的目标 cpu,是否会破坏二进制兼容性?
Just like the title says, If I change the target cpu of a vb.net assembly, will it break binary compatibility?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“二进制兼容性”是一个 VB6 术语,它与生成一个 COM dll 相关,该 dll 对接口和类使用相同的 Guid,这样您就可以更新现有的 dll,而不必担心更新会破坏现有程序。 .NET 代码的规则完全不同,抖动有很大帮助。
DLL 项目的平台目标设置也不是非常相关。只有 EXE 项目的设置很重要,它决定了进程的位数。如果您的 DLL 依赖于旧版 32 位代码,您可以考虑将其强制为 x86。这将使程序在 BadImageFormatException 上更快崩溃,而不是得到一个不起眼的 COM 异常。
"Binary compatibility" was a VB6 term, it was relevant to generating a COM dll that used the same Guids for the interfaces and classes so you could update an existing dll and not fear that your update would break the existing program. The rules are completely different for .NET code, the jitter helps a lot.
Nor is the Platform target setting for a DLL project very relevant. Only the setting on the EXE project matters, it determines the bitness of the process. You could consider forcing your DLL to x86 if it has a dependency on legacy 32-bit code. That will make the program crash quicker on the BadImageFormatException instead of getting an obscure COM exception.