kellyethridge / VBCorLib

The VBCorLib framework brings many of the powerful .NET classes to VB6.
http://www.kellyethridge.com/vbcorlib/
MIT License
116 stars 28 forks source link

The type library importer encountered an error during type verification. Try importing without class members #102

Open rrs opened 3 years ago

rrs commented 3 years ago

I'm submitting a bug report

Library Version: 3.2.0

Please tell us about your environment:

Operating System: Windows [10]

Current behavior: When I add a com reference to VB.Ext in Visual Studio 2019 I get the error "error MSB3303: Could not resolve COM reference "e67787fd-71d6-4c37-837d-0300a1e31b5a" version 3.1. The type library importer encountered an error during type verification. Try importing without class members."

note: the version 3.1

If I run TBLImp on the dll directly it gives

"warning MSB3305: Processing COM reference "VBA" from path "C:\Windows\SysWOW64\msvbvm60.dll". Type library importer has encountered an interface not derived from IUnknown: '_HiddenInterface'."

Expected/desired behavior:

Add the com reference to .net projects so i can share the objects across the com boundary

p.s. Really amazing project, can't praise your work here enough!

rrs commented 3 years ago

Hey, any guidance with this? Maybe its not possible to include it in .Net?

rrs commented 3 years ago

Seems you can gen the interop dll manually and ignore the warning and can add that to a .Net project. I had a copy of the dll in SysWow64 but can't remember if i put it there or the installer. Where does the installer install VBCorLib3.dll? If you have tlbimp in the available toolchain where you build it would be great to add this as a step and maybe put the interop dll in the program files folder.

kellyethridge commented 3 years ago

Hello,

This was never built with .NET in mind. I'm unsure why you would want to include it in a .NET project. .NET provides the same functionality since VBCorLib is just a type of re-implementation of many of the .NET classes.

rrs commented 3 years ago

It's useful for the com boundary. We have a large scale application written in vb6. The upgrade path is to add new features using WPF in .Net and slowly transition some of the core screens over to .Net. Being able to pass things like ArrayList over the com boundary is really useful, obviously it is not interchangeable with the .Net versions of the classes, but the data can just be mapped between the native version and yours.

rrs commented 3 years ago

p.s. From your overview "This allows for easy data sharing between a .NET application and VB6.". I interpreted this to mean that it would work in .Net, and it does, its just that the Visual Studio wrapper around tlbimp surfaces the underlying warning as an error and there doesn't seem to be a way around this. Generating the Interop.VBCorLib3.dll manually works and you can just ignore the error.

I think the warning is coming from the VB collection type, probably as a return type or argument on one of the public methods, you can only instantiate it within the vb6 runtime and so it complains about that.