Link to home
Start Free TrialLog in
Avatar of DjDezmond
DjDezmondFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Creating DLLs vb.net 2005 to reference in vbscript

Forgive the relatively simple question, but i cant seem to find any information on it.

I normally write activeX controls with vb6 as it exports them to ocx which I find easier to work with. However, I have decided to move up and start using vb 2005 for this, but it saves the control as DLL which i cant seem to register with regsrv32.exe, which means i cant reference it in my scripts.

Am i doing something wrong to stop it from registering, or do we deal with these DLL librarys differently now?
Avatar of Jason Evans
Jason Evans
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi there.

.NET compiles the control in a .NET Assembly file (.DLL). This is different to the old ActiveX DLL's from the VB 6 days. You can't register these .NET Dll's, to use them with a .NET project, you must add a reference to them in the project.

Jas.
Avatar of AlexFM
AlexFM

To use .NET Dll in VBScript, it is necessary to register it for COM interoperability. In the project settings, select Compile tab and check "Register for COM interop". .NET Dll is registered as COM library and can be used by COM clients. See also: regasm.exe program.
Avatar of DjDezmond

ASKER

I need to create them to use with VbScript, so i need to reference them externally, ill never be using them with another .net project.

Can this not be done?
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
We are working on what is arguably the largest VB6/VB.NET application in the world - over 5,000,000 (Yes, I said 5 MILLION) total lines of code.  The majority of the Client layer (The application runs on Windows Workstations distributed to more than 130 sites world-wide - this is NOT a Web-based application) is written in VB6, while the Business and Datalayer code is written entirely in VB.NET 2005 (The client workstations commnicate with a single, centalized database, via Web Services).  The Business and Datalayer DLLs are all compiled as COM_Compatible DLLs, which are 'registered' using REGASM, so thast the .NET code can be accessed from the VB6 Front-end.  This same configuration would be accessible, in almost the same way, from VBScript, it that were necessary.

AW
OK boys, thanks alot.

I've used that link alex and it explained it pretty well. Just one more question...

To avoid using REGASM (this dll will be deployed everytime we build an image, so id rather cut down on un-needed exes) what is my component ID?

CreateObject("  ")

The DLL info is as follows:

Assembly name : CapBuildControl
Root namespace: CapBuildControl
ComClass : ControlClass
Filename : CapBuildControl.dll

Or is it something else?
BTW... it wont register still with regsvr32.exe, so im assuming if its in the same directory as the script, it should still create?
I don't think that you can avoid using regasm. It must be part of installation process: registering .NET Dll as COM component. On developer computer, this is done by Visual Studio in the end of project build, but on target computer you must register library.
Yea, ive just worked that out. It was working all along on my developing machine, i was just struggling on my test machine. I didnt first realise that REGASM would already be on the target machines, so it wont be a problem.

Again, thanks alot lads.