Kris Van den Bergh
Kris Van den Bergh

Reputation: 1152

compiling VB6 code in .NET environment

Is one able to compile VB 6 code in Visual Studio.NET ? In other words, is it backwards compatible with older VB code?

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?

Kind regards, Kris

Upvotes: 9

Views: 2701

Answers (4)

Jason Evans
Jason Evans

Reputation: 29186

No, you can't compile VB6 code in any VS.NET version.

Upvotes: 4

Hans Passant
Hans Passant

Reputation: 942348

You can open a VB6 .vbp project file in Visual Studio. This automatically invokes the project converter, it will try to translate your VB6 code into VB.NET. The translator does a fairly decent job of it but the VB.NET language has changed pretty drastically. It depends on how 'clean' your VB6 code was.

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. 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.

Upvotes: 2

Harrison
Harrison

Reputation: 9100

While you cannot compile vb6 in the .net Visual Studios, you may use interop libraries to allow vb.6 to utilize managed code http://msdn.microsoft.com/en-us/library/kew41ycz%28VS.71%29.aspx

Upvotes: 7

Stefan Egli
Stefan Egli

Reputation: 17028

No it is not compatible. I think there is an upgrade wizard, but you will end up fixing some stuff manually.

Upvotes: 1

Related Questions