I have excluded most of the code in the class because it is, complicated, not relevent to my question, it works fine, and there's too much. When i refrence the generated dll in C# it works fine, BUT is says its a .NET Assembly , even though I am trying to make a COM. When I try to load the dll in Visual Basic it doesnt work; The generated .tlb does not work in either. If any one could tell me what im doing wrong I would appreciate it
using
System;using
System.Collections.Generic;using
System.Text;using
System.Windows.Forms;using
System.Runtime.InteropServices;namespace
EButtons{
[
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface _EButton{
}
[
ClassInterface(ClassInterfaceType.AutoDual)] public class EButton : _EButton{
public EButton() { }// assorted methods and members
}
}
When I try to refrence it in vb it gives me a message along the lines of "...only assemibly with the extension DLL and com compenents can be refrenced. Plz make sure the file path is valid and the thing is not in use...."

Exposing to COM not working
Ross Watson
If you compile a C# program the output is going to be a .NET Assembly. You can implement a COM object using .NET but the DLL is still going to be a .NET Assembly.
What's more, traditional COM objects usually have a copy of the type library embedded as a resource but .NET assemblies don't. You can generate (and register) a type library by running regasm against the .NET Assembly that implements your COM object using the /tlb switch.
How are you loading the DLL into Visual Basic 6 (I assume it is 6 we are talking about here )
From a quick test, using Project | References I was able to browse to where the regasm /tlb generated type library was and add a reference to it. I was also able to just scroll through the list of available references until I found the registered type library (since regasm /tllb writes the appropriate registry entries under the typelib key).
Michael Luttmer
You have to put the assembly name before the option switch...
RegAsm.exe E:\Files\test3\EButton\EButton\bin\Release\EButton.dll /tlb
Or, if you want to explicitly specify the type library name...
RegAsm.exe E:\Files\test3\EButton\EButton\bin\Release\EButton.dll /tlb:C:\foo.tlb
shanejh
thanks bro, it worked but it gives me this error message when i try to refrence it:
A refrence could not be added. Converting the type library to a .net assembly failed. type library EButton was exported from a CLR and can not be re-imported as a CLR assembly
Jakein2006
visual basic .net 2003 HE , i tried to refrence it
----------------------
Boy i am feeling like an idiot, i cant get this to work, i type into the cmd line:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe/tlb[:E:\Files\test3\EButton\EButton\bin\Release\EButton.dll]
I get this message:
The file name, directory name, or volume label syntax is incorrect.
I have double checked the file path , as well as putting in as many variations that i could think of..........