Using WCF in VB6?

One of the demos a peer of mine gave (Johnathan) included creating a .NET form with a Web reference that, using the interop toolkit (just released), could be called from a VB6 app. This is a great scenario because it enables those with a VB6 legacy code base to use some of the cool features in .NET without having to rewrite their VB6 applciations.

While I thought that was cool, I wanted to see if the same was possible with WCF in .NET 3.0. As you probably know, the benefit of WCF services is that it highly configurable unlike ASMX in .NET 2.0. The biggest issue in VB 6, however, is to figure out where to add that configuration.

The solution is to name the configuration myapp.exe.config and place it right next to the executable, which is simple enough if you publish the VB6 app.

What about if you want to debug it from the VB6 IDE?

In this case, name the configuration vb6.exe.config and place it right next to the vb6.exe in the VB98 directory.

Actual Steps:

  1. Install the Interop Toolkit
  2. Use the InteropForm project template to create a new project (you don't need to do this, but this really is the simplest way)
  3. Use svcutil to generate a WCF proxy to consume the service (alternatively use Orcas CTP and new Service Reference  dialog -
  4. Use the Service reference in your form.
  5. Select Tools->Generate Interop Wrapper Classes from the Menu Items
  6. Build the project.
  7. Open VB6
  8. Add a Project -> Reference to the .NET project's dll
  9. Call the new InteropForm like you would call any other VB6 form.

What's really cool is that you get great intellisense on the InteropForm from VB6!

Let me know if you have any issues.


Skip to main content