Use .Net created dll in VB6
I need to call a .net created dll in VB6 project. It always give me this error, when I create instance of this class "error 2147024894(80070002) File or assembly name DllName, or one of its dependencies, was not found." This error was happened on a machine with .net runtime installed only. It runs fine in a machine with .net developer version installed.
Does anybody has any idea? Thanks a lot!
Re: Use .Net created dll in VB6
Re: Use .Net created dll in VB6
There are the steps to follow:
- Create a class library in VS choose whatever language you want either Vb.NEt
- or C#
- Goto to Project Properties->ConfigurationProperties->build, check the Register for Com Interop checkbox. This creates the COM wrapper for your .NET assembly and hence need not use regasm.
- Write whatever code you want, expose the classes publicly, expose the properties, functions you want publicly.
Now in your VB project, add the classlibrary.tlb created by the above program.
Now use the classes and functions as you want.
you shoudl not have any problem.
Re: Use .Net created dll in VB6
Hi Beter 2 Burn Out
When you deploy a .NET DLL, and you want to use it with COM (such as VB),
you need to register it with "Regasm.exe your_aseembly_file /codebase".
you need to include the /codebase switch when registering assembly in folders
other than GAC.
To use the /codebase switch, the assembly must be strongly-named.
Re: Use .Net created dll in VB6
hi,
I have created a .net dll with Register For Com Introp option to true and also Signed it. I have copied .dll and .tib files to another machine and registered it with Regasm command. I opened Visual Studio 6.0 and tried to add reference of .dll file, it throws error "Can't add reference" and when I tried to add .tib file, reference added but I cannot see my Namespace/Class though they are public !
Am I missing some step over here?
Thanks
Re: Use .Net created dll in VB6
Hi,
It was same typical windows problem. We need to restart the machine after Regasm command.
so fixed it.
Thanks