regasm /codebase should not required

X

xamman

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
 
B

Branco Medeiros

xamman said:
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.
 
M

Mythran

xamman said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top