Interop incorrect on Windows 7 64-bit

Skip to first unread message

Martin Bryant

Dec 13, 2011, 10:17:31 AM12/13/11
We have an old VB6 COM DLL that we reference in our VB.Net project. This
works fine when running VS on Windows XP.

However, when running VS on Windows 7 64-bit the Interop generated has some
(but bizarrely not all!) of the VB6 object's properties converted to get/set
accessor methods
e.g. if we have an object called X with a property called Y the Interop
thinks the object X has two methods called get_Y and set_Y

So with strong typing the compiler can't compile lines containing X.Y
The Intellisense doesn't even offer Y, just get_Y and set_Y ! Horrible!

Obviously we have thousands of lines of coding using simply X.Y and don't
want to have to change some of them to X.get_Y and some to X.set_Y !!!

I suspect this is happening because when running VS on Windows 7 64-bit,
when you add a reference or build your project, it invokes a 64-bit version
of TLBIMP.EXE to generate the Interop file rather than a 32-bit version.
I have tried explicitly targeting the project at x86 but it doesn't seem to
make any difference to the Interop generated.
This happens in VS2008 and VS2010.

Anyone else have a similar problem?
Is there a way to force VS to use a specific TLBIMP.EXE?

Reply all
Reply to author
0 new messages