Ask a questionAsk a question
 

AnswerRegasm problem

  • Tuesday, April 24, 2007 4:21 PMbarkingdog Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I created a dll under VS 2005 using the ComClass template. Then I  added a reference to it under VB6 (on the same box), invoked the dll as a COM object, and everything worked fine.

     

    Next I went to another machine planning to invoke the same "COM" object from this VBscript

     

     

       Dim myObj 
        
         Set myObj = CreateObject  ("ComObj.ComObjWrapper")

       
         Text1.Text = myObj.TestMethod("12345")

     

     

    (Sorry, no VB6 on that box.)

     

    Before running this script I put the "COM Object Dll"  and the .vbs file in directory C:\Test and ran this:

     

    cd Test

    c:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm  Comobj.dll /tlb:ComObj.tlb

    <Enter>

     

    I get "Assembly Exported To C:\Test\ComObj.tlb and the type library was successfuly registered"

     

    But when I ran the vbs script I got: "the system cannot find the file specified", ErrorCode 80070002. (The assembly I wrote relies on a third-party .NET library but I installed that on the new box before running the .vbs in the first place.)

     

    Any help appreciated.

     

    TIA,

     

    Barkingdog

     

     

    P.S. I don't think I need to use the regasm .codebase option as I plan to place the dll and .tlb files in the same directory as the .vbs. (or .EXE, when that become available.)

     

     

Answers

  • Tuesday, April 24, 2007 5:03 PMDerek Smyth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

     

    I think you need to install your assembly, Comobj.dll, into the GAC. I found this was a requirement when using .NET v1.1 even though the documentation said otherwise. Hopefully someone will give you a better solution but if all else fails installing to the GAC should work.

  • Wednesday, April 25, 2007 1:59 PMDerek Smyth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

     

    Just a correction, I didn't really mean the documentation said otherwise, what I meant was the documentation (that I read anyway) didn't really say anything at all about putting the assembly in the GAC.

All Replies

  • Tuesday, April 24, 2007 5:03 PMDerek Smyth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

     

    I think you need to install your assembly, Comobj.dll, into the GAC. I found this was a requirement when using .NET v1.1 even though the documentation said otherwise. Hopefully someone will give you a better solution but if all else fails installing to the GAC should work.

  • Tuesday, April 24, 2007 5:16 PMbarkingdog Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Wow! I will try that. The documentation I read no made no mention of needing to do this. (It was simply an option if I wanted to.)

     

    Barkingdog

     

     

  • Wednesday, April 25, 2007 1:59 PMDerek Smyth Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

     

    Just a correction, I didn't really mean the documentation said otherwise, what I meant was the documentation (that I read anyway) didn't really say anything at all about putting the assembly in the GAC.

  • Thursday, May 03, 2007 9:51 AMdewaldg™ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    doesn't seem to work for me.

    have the same problem.

     

    any help would be greatly appreciated

  • Thursday, May 03, 2007 2:45 PMbarkingdog Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer

    I finally got it to work. It can be a private assembly.

     

    I used the VS.NET 2005 ComTemplate to generate a DLL. Then I took the object to another computer, put it in directory "Install", and ran regasm on it. The command line looked like this:

     

    c:\Install\> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm ComObj.dll /codebase

     

    I could then invoke the object successfully from .vbs. and VB6. (It turned out that the client app is old and needed a "self registering dll", which apparently mine isn't. I working on that now.)

     

    Barkingdog

    • Proposed As Answer byPatrice O Wednesday, November 04, 2009 4:52 PM
    •  
  • Thursday, June 28, 2007 4:32 PMRandy Okubo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for posting this!  All of the other documentation that I had seen just said something like "use regasm".  The key to getting it to work for me was to add /codebase, which I didn't see anywhere else.
  • Wednesday, November 04, 2009 4:53 PMPatrice O Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanx a lot ! I was seeking for the solution for days !!!

    I just precise you get a warning when registering the assembly if it doesn't have a strong name (even if it seems to work). 



    Searching... wondering...