DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 24 Jul 2007 18:16:01 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    Mike S
          2    Mike S
                 3    Phil Wilson


Regasm is for ComVisible .NET Assemblies -AND- PIA's???   
OK, I used to think I understood what RegAsm was for: if you are
exposing a .NET assembly to COM, you RegAsm the assembly to add all of
the necessary COM entries to the registry so that the COM runtime can
instantiate your ComVisible .NET classes - I thought that was the *one
and only* scenario where you needed it (because why else would you
need COM registration entries unless you wanted COM clients to see
your .NET classes???)

Now I'm seeing various MSDN pages and blog posts suggesting that
Primary Interop Assemblies should be RegAsm'ed for one reason or
another, with no real explanation as to why they need to be.

I guess I'm confused because a PIA is wrapping an existing COM
component that will be used from .NET, so why the heck do you need the
extra meta-data in the registry that RegAsm will add to the existing
COM entries? Shouldn't registering the original COM component be
enough?

The extra meta-data makes perfect sense when you're RegAsm'ing a .NET
component that is being exposed to COM, because in that case
mscoree.dll is registered as the COM server and thus the CLR obviously
needs additional information to load your .NET assembly and the
necessary types when a COM client tries to instantiate your class(es),
but what purpose does this extra meta-data serve when you register a
PIA? The PIA is already referenced by the .NET assembly that is using
the corresponding COM component, so the registry entries seem
superfluous, since the referencing assembly already knows where the
PIA is...

So, a few questions:

    1. Should you always RegAsm Primary Interop Assemblies?
    2. WHY do you need to RegAsm them in the first place?
    3. What about non-primary Interop Assemblies? Do they get
RegAsm'ed?

--
Mike S
Date:Tue, 24 Jul 2007 18:16:01 -0700   Author:  

Re: Regasm is for ComVisible .NET Assemblies -AND- PIA's???   
On Jul 24, 9:16 pm, Mike S  wrote:


> I guess I'm confused because a PIA is wrapping an existing COM
> component that will be used from .NET, so why the heck do you need the
> extra meta-data in the registry that RegAsm will add to the existing
> COM entries? Shouldn't registering the original COM component be
> enough?


Well, I'm going to answer a portion of my own post - I should've read
the "official" PIA primer on MSDN before posting...

What what I just read (http://msdn2.microsoft.com/en-us/library/
aa302338.aspx), a PIA needs to be RegAsm'ed so that Visual Studio can
reference the PIA instead of generating a new IA when you add a
reference to a COM component that has a PIA associated with it. I sort
of suspected the extra registry keys were being used by the IDE, and
not by the CLR per se.

But I'm still a bit confused. Since it seems like these extra registry
entries are only used by the IDE to differentiate between plain old
COM components and those that have PIAs, I wondering if I need to
RegAsm the PIA's when I deploy components to a client machine. That
is, in a compiled .NET assembly using the COM classes defined in the
PIA, the assembly will already be referencing the PIA, so do I need to
RegAsm the PIA on the client machine, or is installing the PIA's
assembly file to the GAC enough? It seems like the extra registry
entries are just there to so that the IDE can locate any PIA's while
it's enumerating the keys under HKLCR\TypeLib...

--
Mike S
Date:Tue, 24 Jul 2007 18:46:43 -0700   Author:  

Re: Regasm is for ComVisible .NET Assemblies -AND- PIA's???   
I think you're right. In a deployment situation where a PIA (or any interop 
assembly) is being used by an app there's no need to register it. In fact 
I've seen people mistakenly register interop assemblies (with regasm) only 
to find that it affects the actual registration of the COM class it's 
mapping, so unregistering the interop assembly then destroyed the COM 
registration.
-- 
Phil Wilson
[MVP Windows Installer]

"Mike S"  wrote in message 
news:1185328003.968158.92480@g4g2000hsf.googlegroups.com...

> On Jul 24, 9:16 pm, Mike S  wrote:
>
>> I guess I'm confused because a PIA is wrapping an existing COM
>> component that will be used from .NET, so why the heck do you need the
>> extra meta-data in the registry that RegAsm will add to the existing
>> COM entries? Shouldn't registering the original COM component be
>> enough?
>
> Well, I'm going to answer a portion of my own post - I should've read
> the "official" PIA primer on MSDN before posting...
>
> What what I just read (http://msdn2.microsoft.com/en-us/library/
> aa302338.aspx), a PIA needs to be RegAsm'ed so that Visual Studio can
> reference the PIA instead of generating a new IA when you add a
> reference to a COM component that has a PIA associated with it. I sort
> of suspected the extra registry keys were being used by the IDE, and
> not by the CLR per se.
>
> But I'm still a bit confused. Since it seems like these extra registry
> entries are only used by the IDE to differentiate between plain old
> COM components and those that have PIAs, I wondering if I need to
> RegAsm the PIA's when I deploy components to a client machine. That
> is, in a compiled .NET assembly using the COM classes defined in the
> PIA, the assembly will already be referencing the PIA, so do I need to
> RegAsm the PIA on the client machine, or is installing the PIA's
> assembly file to the GAC enough? It seems like the extra registry
> entries are just there to so that the IDE can locate any PIA's while
> it's enumerating the keys under HKLCR\TypeLib...
>
> --
> Mike S
> 
Date:Fri, 27 Jul 2007 11:49:20 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us