Creating DLLs 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?
Who is Participating?
Jason EvansSenior Software DeveloperCommented:
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.

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.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

DjDezmondAuthor Commented:
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?
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.

DjDezmondAuthor Commented:
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?
DjDezmondAuthor Commented:
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.
DjDezmondAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.