Using VS 2008 (vb.net) I need to create an object that I can use in classic ASP with CreateObject

I am very new to VB.net. I already wrote these objects in VB6. I'm just lost on VB.net but (kicking and screaming) I need to learn how to do it. I have been working for several hours with small steps forward. Can anyone post a link that explains how to get started doing this?

I managed to write a class object. I can't tell you how to register it and where name1 and name2 came from in CreateObject ("Name1.Name2").

Regsrv32 won't work. It says "entry point not found" and will not register. Also, I can't seem to drop it into the Assemblies directory. I read something about the regasm command that I am using, but I cannot make this work either.

Thanks in advance for any help.

+1


source to share


3 answers


I'm going to assume that you are not trying to write a COM DLL, but rather a complete project that calls various sub-assemblies like VB6 EXE, ActiveX DLL call. If you can be more specific about what you are trying to do it will help me better.

A few questions about VB.NET and VB6.

1) There is no registration for .NET-only projects. If the EXE or DLL refers to another .NET DLL, the only requirement is that the DLLs are present in the parent directory.

2) You can only register the COM style for .NET applications by registering the .NET assembly with the GAC. However, there are several requirements for this. Do a search in the .NET GAC and it will give you a scoop on how to do this.

3) You can configure the .NET assembly to use COM, in which case it will work according to COM rules, including registering with regsvr.



You will find for a .NET only project that # 2 or # 3 only comes in on rare occasions. # 1 will apply to 90% of your DLL assemblies. It depends on your project.

Common usage for CreateObject allows plugins or installable libraries .. NET handles this through the Reflection API. With the reflection API, you can look in the directory, go through each DLL and see what they are, and create objects from what you find. Search for .NET Reflection to read about it.

If your project is .NET, then I recommend that you create an assembly that references both the main assembly and a separate assembly that defines the interfaces of the objects to be created. That, when you use the reflection API and define the type of an object, you can assign it to a variable of that interface and encode it noramally with intellisense and other helpers.

If you have legacy COM or DLL ActiveX controls, .NET will generate a wrapper class that provides ActiveX objects for .NET. I would spend some time learning how .NET does this. What I am doing is creating a dummy project and has a .NET link to the ActiveX controls I need. Then I find the wrapper and DLL projects she made and move them to the center pane. So when I work on subtasks using the same ActiveX controls, I know where all the wrappers are.

+2


source


You need to go to the properties of the class library and select the Register for COM Interop option. This will make your assembly COM available.



+1


source


You want to create what is called a COM Callable Wrapper (also known as CCW) for your .NET component. This is mainly due to setting up some COM interfaces with some GUIDs and being able to enable "Register for COM Interop" in the project properties (as mentioned) or using regasm.exe.

-1


source







All Articles