Re: Problem Using VB.net Class Library DLL in VBScript

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Finally was able to get it to work. Also had to specify the /codebase option
as my DLL is in a DLL specific path and not in the path of the exe calling it
(wscript.exe or cscript.exe).

The command line I used to register a DLL named DIS.DLL and that exists in
the following directory C:\INGEN\DISPROG\ was:
=====================================================
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Monitor>cd c:\ingen\disprog

C:\INGEN\DISPROG>c:\windows\microsoft.net\framework\v2.0.50727\regasm
dis.dll /codebase
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.

Types registered successfully

C:\INGEN\DISPROG>
=====================================================


"Brian Kudera" wrote:

Ok I think I might be making some progress. The problem with using Regasm
was that I was using the regasm from the 1.0 framework folder. After
switching to the Regasm.exe in the 2.0 framework folder it says it registered
successfully.

I'm still having some issues creating and using one of the classes in my DLL
but I'll post more detail later.

I do have one other question right now- is there any way that I can automate
the registration of this like Visual Studio does to make it more user
friendly for deployment? If the user double clicks on the DLL I would like it
to automatically search for the appropriate regasm tool in the necessary
directory and make the entries in the registry. Is this possible?

=====================================================
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Monitor>cd c:\ingen\disprog

C:\INGEN\DISPROG>c:\windows\microsoft.net\framework\v1.1.4322\regasm dis.dll
Microsoft (R) .NET Framework Assembly Registration Utility 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

RegAsm error: Failed to load 'C:\INGEN\DISPROG\dis.dll' because it is not a
vali
d .NET assembly

C:\INGEN\DISPROG>c:\windows\microsoft.net\framework\v2.0.50727\regasm dis.dll
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.

Types registered successfully

C:\INGEN\DISPROG>
=====================================================


"Phill W." wrote:

Brian Kudera wrote:

I am trying to create one DLL that I can use in vbscripting that has all of
the common codes and other additional input forms, controls, etc. I have
DIS.DLL, namespace is DLL, and so far have written four COM Classes (Project
| Add Item | Com Class) so it automatically generates the GUID's for each of
my classes. Sample code for one of my classes is below.

On my integration machine I tried dropping the DLL in C:\DIS and:
1. Double clicking on it to register to regsvr32 but get the error that the
entry point cannot be found
A .Net assembly, even one designed for Interop, is not a valid 32-bit
executable and can't be fed directly into Regsvr32.

2. Using a regasm.exe tool that I have read about for COM classes, but get
an error saying -Failed to load DIS.DLL because it is not a valid .NET
assembly

That's worrying. Your .Net Assembly is not a valid .Net assembly???

3. Tried using gacutil.exe but am getting an error saying -Failure adding
assembly to the cache: unknown error.
GacUtil and Regasm are entirely different tools for entirely different
different purposes.

Running regasm on your development machine (which the "Register for
InterOp" option does for you) should create you a Type Library (.tlb).
This contains all the COM definitions required.

Use RegTLib.exe on the target machine to "register" the .tlb.

HTH,
Phill W.

.



Relevant Pages

  • Re: How to add a dll to a HTA
    ... register this assembly for COM by executing: ... and then place class.dll into GAC. ... regasm /codebase class.dll ... > I've done a C# class library project, imagine that the dll have the name: ...
    (microsoft.public.scripting.jscript)
  • Re: .NET ActiveX dll and regasm
    ... I figured out if I use Regasm and use the /reg switch which creates a .reg ... I cannot register it as a normal COM component using regsvr32, ... lets say I create a VB6 app and want to use the .NET dll. ... Does the installer of the VB6 app have to register the .NET dll by ...
    (microsoft.public.dotnet.general)
  • Re: .tlb file question
    ... maybe you have to register your component using gacutil before using regasm, ... > into a dll, i used the regasm /tlb command in the command prompt to ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Deploy .NET sub-projects for COM to GAC
    ... The main difference between what regasm does and what a VS setup project ... type library information and a VS Register property doesn't. ... The symptom is the DLL is simply NOT ...
    (microsoft.public.dotnet.framework.interop)
  • Re: a strong named DLL which calls a native one ??
    ... Please make sure your DLL is fully signed ... You can use sn.exe [Microsoft.NET Framework Strong Name Utility] to do ... > I also tried to register my DLL with cgacutil -i MyDLL.dll, ...
    (microsoft.public.dotnet.framework.compactframework)