I have an .exe assembly with a class like
[Guid("2D9EBA5F-7E4A-418B-B151-4E703AEDF396")]
public interface MyInterface
{
int MyMethod();
}
[GuidAttribute("D26278EA-A7D0-4580-A48F-353D1E455E50"),
ProgIdAttribute("My_prog"), ComVisible(true), Serializable]
public class MyInterface: MyClass
{
public int MyMethod()
{
return 1;
}
}
I register it like
regasm 1.exe /tlb 1.tlb
I have two questions:
1) I am opening it with an object explorer, "COM" tab. I can see my assembly, I can see an object there, but I can't see any methods in this class. What's wrong?
2) I am trying to reference it from the second project, Add reference -> COM (VS2010). I get the error:
" A reference to 'assemblyname' could not be added.
The ActiveX type Library 'path\1.tlb' was exported from a .NET assembly and can not added as a reference.
Add a reference to .NET instead "
Yes, I have read this question. But I don't want to make a direct reference to the assembly, I want to access it through COM! What should I do to make the assembly referenceable through COM?