[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.interop

Tlbimp reference naming problem

Andria

5/11/2007 4:29:00 PM

I am trying to write a utility that will go through all of my COM
dll's that I am using in my .NET app and update the Interop wrappers
for them. To do this, I am using tlbimp and have done everything I
want with only one problem. Some of my COM dlls reference other COM
dlls, so tlbimp is generating its own reference dlls when it's run.
The naming of these is different than the naming I need.

For example, I have my COM dll called PrimaryComDll.dll and it
references RefComDll.dll. When I run the following command:
tlbimp.exe primarycomdll.dll /out:Interop.PrimaryComDll.dll it
generates Interop.PrimaryComDll.dll, but also generates
RefComDll.dll.

What I want is for it to reference the existing Interop.RefComDll.dll
that I have already generated, or at least to generate another with
that same name so my references stay intact. I'm not sure why, but it
works the way I want when done through the VS2005 IDE. It creates all
dependency dlls with the Interop. prefix. I thought the Add Reference
dialog just used the tlbimp behind the scenes, but obviously something
else is happening here. Any idea how I can make the command line
version of tlbimp execute the same way as the Add Reference dialog
through the IDE?

4 Answers

(Mattias Sjögren)

5/11/2007 5:32:00 PM

0


>What I want is for it to reference the existing Interop.RefComDll.dll
>that I have already generated, or at least to generate another with
>that same name so my references stay intact.

You can do that with Tlbimp's /reference option.


Mattias

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

Andria

5/11/2007 6:51:00 PM

0

>
> You can do that with Tlbimp's /reference option.
>


Well, I would agree with you except that I'm trying to do this
automated across over 50 dlls and I don't know the references each dll
is going to need to have generated at the time. The only thing I
could come up with is having a huge batch file and that's exactly what
I don't want since it would require maintenance whenever a COM dll is
added/deleted/changed, etc.

The utility I've written just scans the directory of com dlls and runs
tlbimp on them to create the corresponding interop dlls. The only
references that these will need have already been created as interop
dlls, so it shouldn't need to recreate the reference dlls. Like I
said, I really just want it to use the Interop.[Namespace].dll naming
convention like it uses through the IDE...but for some reason running
tlbimp directly from command line gives a different naming
convention. (Namespace.dll)

(Mattias Sjögren)

5/11/2007 10:00:00 PM

0

>The utility I've written just scans the directory of com dlls and runs
>tlbimp on them to create the corresponding interop dlls. The only
>references that these will need have already been created as interop
>dlls, so it shouldn't need to recreate the reference dlls. Like I
>said, I really just want it to use the Interop.[Namespace].dll naming
>convention like it uses through the IDE...but for some reason running
>tlbimp directly from command line gives a different naming
>convention. (Namespace.dll)

If you need that level of control maybe you should write your own
utility using the TypeLibConverter class rather than relying on
Tlbimp. That way you can handle ITypeLibImporterNotifySink.ResolveRef
any way you want.


Mattias

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

Andria

5/14/2007 3:36:00 PM

0


> If you need that level of control maybe you should write your own
> utility using the TypeLibConverter class rather than relying onTlbimp. That way you can handle TypeLibImporterNotifySink.ResolveRef
> any way you want.
>


Where can I find more information on implementing this class? I have
seen little about actually using it. I would like to see some
examples of someone actually using it...anything out there I can look
at? Thanks.