I need some gaps filled in my knowledge about the GAC and interop assemblies

jimd2012

Member
Joined
Jul 11, 2012
Messages
6
Programming Experience
1-3
I have a COM dll called "Magic.dll." I did not make it. It exposes some classes which are useful to me, but referencing it directly creates a large number of warnings. Refrencing it directly *also* generates two new assemblies, "Interop.Magic.dll" and "Interop.VBA.dll."

I found that if I copy+paste these two assemblies, then remove the references to Magic, and add references to these interops instead, the warnings go away completely, and the code still works. However, now I need to ensure anyone building my project has these interops, rather than the COM magic dll. The GAC seems like the intuitive standard place to put them. But if I drag either of them into c:\windows\assembly, nothing happens. I've tried a bunch of things with tlbimp, trying to make strong-named assemblies and use various other options that I half understand, but I'm not really sure what I'm doing, and everything I have tried went wrong in some way.

So, what do I need to do? Or rather, what do I need to know, that I don't already know?
 
I always just drag & dropped it into c:\windows\assembly. It's worked for other .NET assemblies, including interops that other publishers provided themselves. When I try it on these, nothing happens at all.

If I run gacutil on the interops that were generated by VS2010, it refuses and states that they must be strongly named. So I've tried making the interops manually, but I'm not really sure what the proper procedure is. I've tried multiple approaches, and none of them have worked right.
 
If the DLL was made in VC++ for example, them you have to import each function you need to use from the dll, something like this:

Private Declare Function SomeLocalFunctionName Lib "Magic.dll" Alias "BSAlias" (ByVal sBuffer As String, lSize As Long) As Long


Then you just call SomeLocalFunctionName to use it.
 
I don't know what it was made in, but I don't need to import anything like that to use it. I can simply add a reference in the project properties, and all the methods I need are available. My guess is that the DLL was made in VB6, but I don't know that for sure.
 
Back
Top