[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Must the .NET DLL be installed in the GAC to be used by COM?

JustDoIt

3/1/2007 3:39:00 AM

The docs I've read aren't too clear about that. Seems to me they should
work anyway. That's what registration is for.

Also, I have successfully created a .NET DLL with a public class and public
default constructor and registered it but nothing shows in the object
browser in VB6. When I use regasm without creating a type library it says
"no types were registered" but if I also create a type library then that
error doesn't occur. Any ideas what I should check? Is there a simple CCW
example in C# out there anywhere?


5 Answers

(Mattias Sjögren)

3/1/2007 6:10:00 AM

0

>The docs I've read aren't too clear about that. Seems to me they should
>work anyway. That's what registration is for.

No it doesn't have to be installed in the GAC. Anywhere the CLR can
find it using normal assembly loading rules is fine.


>Also, I have successfully created a .NET DLL with a public class and public
>default constructor and registered it but nothing shows in the object
>browser in VB6. When I use regasm without creating a type library it says
>"no types were registered" but if I also create a type library then that
>error doesn't occur. Any ideas what I should check?

See http://www.dotneti.../faq/?q=Clas...


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.n... | http://www.dotneti...
Please reply only to the newsgroup.

JustDoIt

3/1/2007 3:09:00 PM

0

Just to be clear:

- COM instantiates the CCW DLL. I assume Windows knows where this DLL is
located because it is registered as a COM object. This DLL is *not* in the
GAC in my case. It will be in a Program Files directory for my application.

- This CCW DLL references other .NET assemblies located in the same
directory.

That will work?


"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:u0wTLh8WHHA.5108@TK2MSFTNGP06.phx.gbl...
> >The docs I've read aren't too clear about that. Seems to me they should
>>work anyway. That's what registration is for.
>
> No it doesn't have to be installed in the GAC. Anywhere the CLR can
> find it using normal assembly loading rules is fine.
>
>
>>Also, I have successfully created a .NET DLL with a public class and
>>public
>>default constructor and registered it but nothing shows in the object
>>browser in VB6. When I use regasm without creating a type library it says
>>"no types were registered" but if I also create a type library then that
>>error doesn't occur. Any ideas what I should check?
>
> See http://www.dotneti.../faq/?q=Clas...
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP] mattias @ mvps.org
> http://www.msjogren.n... | http://www.dotneti...
> Please reply only to the newsgroup.


ME

3/1/2007 5:21:00 PM

0

I got a lot of good information from this article as well:

http://msdn.microsoft.com/msdnmag/issues/05/04/R...

Thanks,

Matt


"Jen" <none@nowhere.com> wrote in message
news:%23%23YKYL7WHHA.3500@TK2MSFTNGP05.phx.gbl...
> The docs I've read aren't too clear about that. Seems to me they should
> work anyway. That's what registration is for.
>
> Also, I have successfully created a .NET DLL with a public class and
> public default constructor and registered it but nothing shows in the
> object browser in VB6. When I use regasm without creating a type library
> it says "no types were registered" but if I also create a type library
> then that error doesn't occur. Any ideas what I should check? Is there a
> simple CCW example in C# out there anywhere?
>
>


JustDoIt

3/1/2007 5:34:00 PM

0

Ok, I didn't know AssemblyInfo.cs set ComVisible to false. That was a
problem.


(Mattias Sjögren)

3/1/2007 9:52:00 PM

0

>- COM instantiates the CCW DLL. I assume Windows knows where this DLL is
>located because it is registered as a COM object. This DLL is *not* in the
>GAC in my case. It will be in a Program Files directory for my application.

There's no such thing as a CCW DLL (a CCW is an object created at
runtime) so I'm not sure I understand exactly what you're referring
to.

But the DLL registered for all managed COM objects is mscoree.dll, so
that's what Windows will load. The code in mscoree.dll will then use
the information in the registry and normal CLR assembly resolving
rules to load the assembly that actually implements the COM class.

Specifically, if the component was registered with Regasm.exe's
/codebase option, the assembly will be loaded from the specified path
(like calling Assembly.LoadFrom). Otherwise the assembly will be
loaded by name (like Assembly.Load), and the runtime will look for it
in the GAC, application base directory, other locations specified i a
config file etc.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.n... | http://www.dotneti...
Please reply only to the newsgroup.