Results 1 to 5 of 5

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

  1. #1
    jimd2012 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jul 2012
    Posts
    6
    Reputation
    0

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

    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?

  2. #2
    Herman is offline VB.NET Forum Miyagee
    .NET Framework
    .NET 4.0
    Join Date
    Oct 2011
    Location
    Montreal, QC, CA
    Posts
    466
    Reputation
    348
    To install an assembly in the GAC you need to use the gacutil.exe utility. What kinds of warning are you getting exactly?

  3. #3
    jimd2012 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jul 2012
    Posts
    6
    Reputation
    0
    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.

  4. #4
    Herman is offline VB.NET Forum Miyagee
    .NET Framework
    .NET 4.0
    Join Date
    Oct 2011
    Location
    Montreal, QC, CA
    Posts
    466
    Reputation
    348
    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.

  5. #5
    jimd2012 is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Jul 2012
    Posts
    6
    Reputation
    0
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking