locked
Register COM Interop RRS feed

  • Question

  • Hi

    I am having trouble registering a .NET assembly I created.

    I followed the Create a COM callable assembly in Visual Basic .NET example.

    I copied onto another machine the following files into the same folder.

    Project1.exe (the VB6 app)

    And for the COM callable assembly

    TestProj.dll

    TestProj.pdb

    TestProj.tlb

    TestProj.XML

    When attempting to run the VB6 app on the other machine I get "ActiveX component can't create object" when it is trying to reference the COM object.

    I then tried to register it by copying in regasm.exe and then at a command prompt trying 

    Regasm TestProj.dll /tlb: TestProj.tlb /codebase

    Which returns "failed to load <filepath>\TestProj.DLL because it is not a valid .NET assembly.

    Friday, July 13, 2012 8:26 PM

Answers

  • Hi Bob,

    You receive this error "failed to load dll because it is not a valid .net assembly" when trying to registry this DLL, I suppose the .NET framework version (regasm.exe) on this machine is not compatible with this assembly. I would suggest to upgrade .NET framework to the same as DLL's.

    If I misunderstood, please feel free to let me know.

    Best regards,


    Shanks Zen
    MSDN Community Support | Feedback to us

    • Marked as answer by Youen ZenModerator Wednesday, July 25, 2012 3:12 AM
    • Unmarked as answer by bob132 Monday, August 6, 2012 12:54 PM
    • Marked as answer by bob132 Monday, August 6, 2012 12:54 PM
    Monday, July 16, 2012 8:56 AM
    Moderator
  • It was because Windows 7 knew that the DLL was downloaded from the web (I used Dropbox to get it from one machine to another). To fix it, I right-click the DLL, choose Properties, then click the "Unblock" button. I could then register OK.
    • Marked as answer by bob132 Monday, August 6, 2012 3:02 PM
    Monday, August 6, 2012 3:02 PM

All replies

  • Hi Bob,

    You receive this error "failed to load dll because it is not a valid .net assembly" when trying to registry this DLL, I suppose the .NET framework version (regasm.exe) on this machine is not compatible with this assembly. I would suggest to upgrade .NET framework to the same as DLL's.

    If I misunderstood, please feel free to let me know.

    Best regards,


    Shanks Zen
    MSDN Community Support | Feedback to us

    • Marked as answer by Youen ZenModerator Wednesday, July 25, 2012 3:12 AM
    • Unmarked as answer by bob132 Monday, August 6, 2012 12:54 PM
    • Marked as answer by bob132 Monday, August 6, 2012 12:54 PM
    Monday, July 16, 2012 8:56 AM
    Moderator
  • Thank you. that helped.

    I now get Could not load file or assembly 'file:///c:\TestProj\testproj.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

    Are you able to advise further please?

    Monday, August 6, 2012 12:57 PM
  • It was because Windows 7 knew that the DLL was downloaded from the web (I used Dropbox to get it from one machine to another). To fix it, I right-click the DLL, choose Properties, then click the "Unblock" button. I could then register OK.
    • Marked as answer by bob132 Monday, August 6, 2012 3:02 PM
    Monday, August 6, 2012 3:02 PM