regasm /codebase should not required

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xamman

    #1

    regasm /codebase should not required

    hi there, i am trying to use a .NET assembly from a Cscript.exe .vbs
    (i.e. from COM)
    and could not get my .vbs to use my .net dll (gives a 'file not found
    error')
    unless i used the /codebase parameter when registering .net dll with
    regasm.

    from what i read,a simple regasm dllname.dll and putting the dll and
    cscript.exe in the same folder should be sufficient. /codebase should
    not be required.

    any other ideas what we could be doing wrong? thx





















    my original (more verbose) post is below, if required.



    hi there! i have a .NET assembly which just generates a random number
    rand.dll. i want to use it from a simple Cscript .vbs file using the
    createobject vbs command which just instantiates & prints the chosen
    number to screen. This requires COM.

    A
    thus I ticked COM interop in the build options for my class & copied
    the Cscript.exe to my \bin folder where i have rand.dll so the
    Cscript will be able to find the dll.


    I did a regasm /tlb rand.dll & a regasm rand.dll and executed my .vbs .

    It gave me a 'file not found error' obviously referring to the dll
    which holds the class


    B
    then i ran regasm /codebase rand.dll and now the vbs executed.


    I wanted to avoid using /codebase as I thought having the dll in the
    same folder as the COM consumer Cscript would be sufficient. What did I

    do wrong in A?


    PS futher below is another persons post earlier this month with a
    similar problem....


    many thanks & Regards,
    X

  • Branco Medeiros

    #2
    Re: regasm /codebase should not required


    xamman wrote:
    hi there, i am trying to use a .NET assembly from a Cscript.exe .vbs
    (i.e. from COM)
    and could not get my .vbs to use my .net dll (gives a 'file not found
    error')
    unless i used the /codebase parameter when registering .net dll with
    regasm.
    <snip>

    Didn't have any luck with this, also: it seems /codebase is
    mandatory... =P

    Regards,

    Branco.

    Comment

    • Mythran

      #3
      Re: regasm /codebase should not required



      "xamman" <xamman19@yahoo .comwrote in message
      news:1168209882 .607663.54760@1 1g2000cwr.googl egroups.com...
      hi there, i am trying to use a .NET assembly from a Cscript.exe .vbs
      (i.e. from COM)
      and could not get my .vbs to use my .net dll (gives a 'file not found
      error')
      unless i used the /codebase parameter when registering .net dll with
      regasm.
      >
      from what i read,a simple regasm dllname.dll and putting the dll and
      cscript.exe in the same folder should be sufficient. /codebase should
      not be required.
      >
      any other ideas what we could be doing wrong? thx
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      my original (more verbose) post is below, if required.
      >
      >
      >
      hi there! i have a .NET assembly which just generates a random number
      rand.dll. i want to use it from a simple Cscript .vbs file using the
      createobject vbs command which just instantiates & prints the chosen
      number to screen. This requires COM.
      >
      A
      thus I ticked COM interop in the build options for my class & copied
      the Cscript.exe to my \bin folder where i have rand.dll so the
      Cscript will be able to find the dll.
      >
      >
      I did a regasm /tlb rand.dll & a regasm rand.dll and executed my .vbs .
      >
      It gave me a 'file not found error' obviously referring to the dll
      which holds the class
      >
      >
      B
      then i ran regasm /codebase rand.dll and now the vbs executed.
      >
      >
      I wanted to avoid using /codebase as I thought having the dll in the
      same folder as the COM consumer Cscript would be sufficient. What did I
      >
      do wrong in A?
      >
      >
      PS futher below is another persons post earlier this month with a
      similar problem....
      >
      >
      many thanks & Regards,
      X
      >

      I believe that when you use /codebase, it registers the location of the DLL
      within the registry. So, what I would suggest, is if you don't want to use
      /codebase, then once you use regasm on the dll, install the dll into the
      global assembly cache (GAC). It *should* work, but I haven't tested it with
      CScript.

      HTH,
      Mythran


      Comment

      Working...