I am trying to create interop dlls.
Two ways to do, 1. Using C# program, 2. Coomand line
1. C# program:
public class ConversionEventHandler : ITypeLibImporterNotifySink
{
public void ReportEvent(ImporterEventKind eventKind, int eventCode, string eventMsg)
{
// Console.WriteLine("{0}", eventMsg);
}
public Assembly ResolveRef(object typeLib)
{
return null
}
}
Object typeLib;
LoadTypeLibEx(@"C:\Windows\SysWOW64\activeds.tlb", RegKind.RegKind_None, out typeLib);
Version v = new Version(1, 0, 0, 0);
TypeLibConverter tlbConv = new TypeLibConverter();
AssemblyBuilder asm = tlbConv.ConvertTypeLibToAssembly(typeLib, "outDll", 0,new ConversionEventHandler(), null, null, rootNamespace, v);
asm.Save("outDll");
Here issue comes with its unknown to what should provide inResolveRef method.
- Command line: With Developer Coomand Prompt for VS:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>TlbImp.exe C:\Windows\SysWOW64\activeds.tlb out:test.dll
This is working, but I need to run above command using C#.
Can anyone please let me know how I can do this?
Thanks in advance