Friday, May 06, 2005

VB RAD tips on .net interop

VB RAD


  1. Create a strong key by running sn –k mykey.snk from the command line.
  2. Add the path of this generated file to your AssemblyInfo.vb or .cs file in the following manner:
    VB.NET: <Assembly: AssemblyKeyFile("c:\path\mykey.snk")>
    C#: [assembly: AssemblyKeyFile(@"c:\path\mykey.snk")]
  3. After compiling your assembly to a DLL, you must register it for COM Interop from the command line: regasm c:\path\MyDll.dll /tlb:MyDll.tlb
  4. Finally, you should install the DLL into the Global Assembly Cache by dragging the .DLL file into the c:\windows\assembly folder
  5. VB.NET: <ClassInterface(ClassInterfaceType.AutoDual)>
  6. Verify, VB.NET: VB.NET: <GuidAttribute("BA713700-522D-466e-8DD4-225884504678")>
  7. Verify, VB.NET: Imports System.Runtime.InteropServices

No comments: