.NET and COM interop question

cyberia

Platinum Member
Oct 22, 1999
2,535
0
0
Does anybody have experience using components built in .NET as COM components? I know it is possible. I also found enough resources on the Internet about this topic. However, one thing is still not clear to me:

If I build a .NET component on my (development) PC, put a COM "wrapper" around it using the proper procedure, do I need to have the .NET Framework installed on my production server where this COM component (.NET in disguise) will run?

Thanks for suggestions.
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
Interesting question. Let me get this straight, the com server is written in .NET? In other words it's managed code. My guess would be that whatever machine is running that com server will need .NET framework isntalled. The com client (if it's running on a different machine) doesn't necessarily need .NET framework. Of course, this just my limited knowledge of com in .net, i've never attempted anything like. Any reason why you need to write the server in .NET?
 

cyberia

Platinum Member
Oct 22, 1999
2,535
0
0
Originally posted by: Argo
Any reason why you need to write the server in .NET?

I want to move to new technologies without making changes to the current environment.

My organization is way too slow to move to .NET. They want me to keep developing in VB6. I do not want to waste my time using yesterday's technology. (Wait... The time is theirs. The effort, skills and abilities are mine :) )

I figured, I can convince them to make small steps toward .NET if I can use .NET to build COM objects. Luckily, it is possible. As long as no change (.NET framework installation) is necessary on the production server, they might actually buy it.



 

Argo

Lifer
Apr 8, 2000
10,045
0
0
If I were you, I'd start by rewritting COM clients in VB.NET first. Way easier.
 

cyberia

Platinum Member
Oct 22, 1999
2,535
0
0
Makes sense, but... Client apps here are web sites. So, to re-write clients in VB.NET is to go from ASP to ASP.NET. Like I said, we might go into two other major releases of .NET before these people decide on installing .NET Framework on servers.

Better yet, .NET must become outdated before these people decide to go with it. That's pretty much how we got onto COM bandwagon.

Sad... :(
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Yes, you can use .NET assemblies from COM components, and vice versa. To use a .NET assembly from a COM component you need what's called a CCW (COM callable wrapper). To use COM from .NET you need an RCW (runtime callable wrapper). Creating a typelib for a .NET assembly is easy:

regasm yourassemblyname.dll /tlb:yourassemblyname.tlb

Then simply reference your newly created typelib in your VB6/ASP/C++ (with #import) project. Easy enough. Sadly, I'm a command line monkey and I don't know how VS.NET does this for you automagically, although I'm sure it does :)

Creating an RCW is equally easy, just do the following:

tblimp yourcomcomponent.dll /out:eek:utputfile

Of course, simply referencing a COM component in VS.NET will create the RCW for you.
 

cyberia

Platinum Member
Oct 22, 1999
2,535
0
0
Thanks for the extensive reply.

You are correct, it is possible. My question was whether I needed to install .NET framework on my server (not just on the development PC). According to the replies I just got from people at microsoft.public.dotnet.framework.interop, I do. So, no .NET for me for now. :(