简体   繁体   English

在.NET环境中编译VB6代码

[英]compiling VB6 code in .NET environment

Is one able to compile VB 6 code in Visual Studio.NET ? 是否能够在Visual Studio.NET中编译VB 6代码? In other words, is it backwards compatible with older VB code? 换句话说,它是否向后兼容较旧的VB代码?

Since I know there is a difference between managed code (.NET) and unmanaged code, I am wondering if Visual Studio.NET is able to compile unmanaged code as well? 由于我知道托管代码(.NET)和非托管代码之间存在差异,我想知道Visual Studio.NET是否能够编译非托管代码?

Kind regards, Kris 亲切的问候,克里斯

虽然您无法在.net Visual Studios中编译vb6,但您可以使用互操作库来允许vb.6使用托管代码http://msdn.microsoft.com/en-us/library/kew41ycz%28VS.71%29。 ASPX

不,你不能在任何VS.NET版本中编译VB6代码。

You can open a VB6 .vbp project file in Visual Studio. 您可以在Visual Studio中打开VB6 .vbp项目文件。 This automatically invokes the project converter, it will try to translate your VB6 code into VB.NET. 这会自动调用项目转换器,它会尝试将VB6代码转换为VB.NET。 The translator does a fairly decent job of it but the VB.NET language has changed pretty drastically. 翻译工作做得相当不错,但VB.NET语言发生了很大的变化。 It depends on how 'clean' your VB6 code was. 这取决于你的VB6代码是如何“干净”的。

After the conversion is completed, you'll have to walk through the list of warnings and errors you'll get. 转换完成后,您将需要查看警告和错误列表。 Getting none at all is rare. 什么都不做是很少见的。 There might be hundreds or thousands. 可能有数百或数千。 If you're in that boat, it starts making sense to rewrite the code. 如果你在那艘船上,那么重写代码就开始变得有意义了。

Anyhoo, just try and see what hits the fan. Anyhoo,试着看看粉丝是什么。 You'll have a good idea what you're in for in about ten minutes. 大约十分钟你就会明白你的目标。 Don't forget to copy the project before you start the conversion. 在开始转换之前,请不要忘记复制项目。

No it is not compatible. 不,它不兼容。 I think there is an upgrade wizard, but you will end up fixing some stuff manually. 我认为有一个升级向导,但你最终会手动修复一些东西。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM