Trying to register interface, using regasm
I tried to play with AssemblyInfo.cs switching ComVisible, no luck. I tried signing it. Regasm always responds
RegAsm : warning RA0000 : No types were registered
My project is class library , .net 4.5.
My one cs file - Interface.cs looks like this:
using System;
using System.Runtime.InteropServices;
namespace ComTestInterface
{
[ComImport]
[System.Security.SuppressUnmanagedCodeSecurity]
[Guid("647ED2ED-78DB-4168-B50E-DD4C506EAF53")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ImageSourceFilter
{
void SetColor();
}
}
Problem solved. I registered interface in same project where class located. With next code Interface:
[ComVisible(true)]
[System.Security.SuppressUnmanagedCodeSecurity]
[Guid("170BB172-4FD1-4eb5-B6F6-A834B344260F")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IImageSourceFilter
{
void SetColor();
}
Class:
[ComVisible(true)]
[Guid("170BB172-4FD1-4eb5-B6F6-A834B344268F")]
[ClassInterface(ClassInterfaceType.None)]
public class ImageSourceFilter : BaseSourceFilter,IImageSourceFilter
{
public void SetColor()
{...}
}
Also worth mentioning, that class need to inherit this interface. Registration was completed with Post-Build event in project settings with parametrs:
"$(TargetDir)install.bat" $(TargetName)
And install.bat contained next:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe %1.dll /nologo /codebase /tlb: %1.tlb