Re: Creating a Com Component in VB.net 2005
- From: joshturner1967 <joshturner1967@xxxxxxxxx>
- Date: Mon, 6 Oct 2008 07:31:04 -0700 (PDT)
On Oct 3, 5:25 pm, tomek.romanow...@xxxxxxxxx wrote:
Hi Josh !
" a Reference to 'VbCalendar' could not be added. The Active X type
library 'c:\VbCal\VbCalendar\VbCalendar\bin\Debug\VbCalendar.tlb was
exported from a .net assembly and cannot be added as a reference.
Add a reference to the .net assembly instead. Can someone explain
what this means and how to do it??
It's absolutelly normal, whenever you're trying to import to .Net a
COM component which in fact is .Net assembly and you cannot do
anything about it.
If you want to try your component (and have no VB 6.0), then consider
a use of VBScript as a calling code.
And when it comes to making a COM interoperating .NET assembly:
1. the most recomended way is to define an interface, which is then
implemented by your class and also prevent the class to have
autogenerated interface (which might mess up). This can be achieved by
using an ClassInterface attribute with None value - applied on the
class.
2. if you want to ensure both kinds of bindings, then the interfaced
exposed as COM interface must have InterfaceType.InterfaceIsDual
applied
3. COM clients often use ProgID as class "identifier" when making a
new object of given class. By default, in .Net assembly it is a
namespace and class name coupled together. You can set it as you want
with ProgID attribute.
4. All COM compliant classes must have parameterless constructor.
Examples of the above you can find in my post on the list (VB code,
but attributes names are the same in C#) "How to create a Net assembly
as replacement for existing COM component ".
One more thing: you must sign your assembly (give a strong name, as it
is called in .Net). Project properties/Signing tab - if I'm not wrong.
Thanks Tomek! Your answer cleared many things up for me!
.
- Prev by Date: RE: how to create a Net assembly as replacement for existing COM compo
- Next by Date: Re: how to create a Net assembly as replacement for existing COM compo
- Previous by thread: Re: Creating a Com Component in VB.net 2005
- Index(es):
Relevant Pages
|
Loading