Com Interop problem with VB.Net project

I have built a variation of the Ldap Authentication function referenced in http://support.microsoft.com/default.aspx scid=kb;en-us;326340#3

The problem i am having is accessing the resultant .dll
Do I need to research and develop a "strong name" for the assembly   The properties are set to "Register for Com interop".  Is C# a better platform for building COM objects


Answer this question

Com Interop problem with VB.Net project

  • jerMcguire

    Exactly what do you mean by the step 5

    A new COM Class What do you mean by that

  • boms

    VB.NET is a great language for writing COM components in .NET. To make a .NET library that can be called through COM in VB 2005, do the following:

    1) Create a new Class Library project (File->New Project and select Class Library)
    2) Double-click the My Project node in the solution explorer
    3) Select the Application tab on the project designer, and click the Assembly Information button
    4) Make sure the "Make assembly COM-Visible" checkbox is checked and hit OK.
    5) Add a new "COM Class" item to your project (note - this has all the attributes required to make your class visible to COM).
    6) Add whatever public methods you want your component to expose.
    7) Build

    VB 2005 will automatically register the component for you, so you can reference it from your VB6 apps.

    Regards,
    Sean


  • Niclas

    Okay, done that, but now my DLL refuses to be registered. It says DllRegisterServer not found when I try. I guess I've done something wrong here but I can't see what.

    (It's a VBA/Excel application that needs to interact with the DLL in question)

    Thanks in advance.

  • Doug Owens

    This adds an attribute

    <Microsoft.VisualBasic.ComClass()>

     

    Just before the Public Class xxxxx statement.


  • Rob Lorimer

    For you Class that you define in your lass library project.  If you open up the class1.vb file in the code window and look at the Properties.   You will notice that one of the properties is COM Class and by default it is probably set to False.   Change this to True.

     

     


  • Kevlar

    I know it is a little bit old of a question but I had the same problem and just found the solution so I think it can help somebody else.

    What you just need to do is register your dll using regasm http://msdn.microsoft.com/library/default.asp url=/library/en-us/cptools/html/cpgrfAssemblyRegistrationToolRegasmexe.asp

    Hope this helps!

    Regards

    Jerome


  • Com Interop problem with VB.Net project