GAC

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom

    GAC

    hi guys

    I've ready many books to find out about GAC but all books mention gacutil
    but only go as far as gacutil /i and /u

    here's a silly question how do I USE the assembly after its installed to GAC
    ? ie. call on the assembly's functions etc.

    Thanks
    Tom


  • Richard Blewett [DevelopMentor]

    #2
    Re: GAC

    The GAC is simply a deployment option (of which there are many). You normally build your application referencing other assemblies so you can use their functionality and the compiler generates external assembly references in your application assembly's manifest.

    At runtime, the assembly resolver takes the information in the manifest and attempts to convert that information (the external assembly's name) to a physical location to load the assembly from (the CODEBASE). The first place the assembly resolver will look is the GAC.

    If you want to late bind to types in the GAC;d assembly, you need to use the Assembly.Load method passing in the fully qualified name of the GAC'd assembly - e.g.

    Assembly a = Assembly.Load(" Foo, Version=1.0.0.0 , Culture=neutral , PublicKeyToken= aabbccddeeffaa1 1");
    Bar b = (Bar)a.CreateIn stance("Bar");

    Regards

    Richard Blewett - DevelopMentor



    nntp://news.microsoft. com/microsoft.publi c.dotnet.langua ges.csharp/<4191f8d2$0$318 70$afc38c87@new s.optusnet.com. au>

    hi guys

    I've ready many books to find out about GAC but all books mention gacutil
    but only go as far as gacutil /i and /u

    here's a silly question how do I USE the assembly after its installed to GAC
    ? ie. call on the assembly's functions etc.

    Thanks
    Tom

    Comment

    • Richard Blewett [DevelopMentor]

      #3
      Re: GAC

      The GAC is simply a deployment option (of which there are many). You normally build your application referencing other assemblies so you can use their functionality and the compiler generates external assembly references in your application assembly's manifest.

      At runtime, the assembly resolver takes the information in the manifest and attempts to convert that information (the external assembly's name) to a physical location to load the assembly from (the CODEBASE). The first place the assembly resolver will look is the GAC.

      If you want to late bind to types in the GAC;d assembly, you need to use the Assembly.Load method passing in the fully qualified name of the GAC'd assembly - e.g.

      Assembly a = Assembly.Load(" Foo, Version=1.0.0.0 , Culture=neutral , PublicKeyToken= aabbccddeeffaa1 1");
      Bar b = (Bar)a.CreateIn stance("Bar");

      Regards

      Richard Blewett - DevelopMentor



      nntp://news.microsoft. com/microsoft.publi c.dotnet.langua ges.csharp/<4191f8d2$0$318 70$afc38c87@new s.optusnet.com. au>

      hi guys

      I've ready many books to find out about GAC but all books mention gacutil
      but only go as far as gacutil /i and /u

      here's a silly question how do I USE the assembly after its installed to GAC
      ? ie. call on the assembly's functions etc.

      Thanks
      Tom

      Comment

      • Mattias Sjögren

        #4
        Re: GAC

        [color=blue]
        >here's a silly question how do I USE the assembly after its installed to GAC
        >? ie. call on the assembly's functions etc.[/color]

        Same way as for assemblies that haven't been installed into the GAC.
        You reference a copy of the assembly (not the one in the GAC) and go
        from there.



        Mattias

        --
        Mattias Sjögren [MVP] mattias @ mvps.org
        http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
        Please reply only to the newsgroup.

        Comment

        • Mattias Sjögren

          #5
          Re: GAC

          [color=blue]
          >here's a silly question how do I USE the assembly after its installed to GAC
          >? ie. call on the assembly's functions etc.[/color]

          Same way as for assemblies that haven't been installed into the GAC.
          You reference a copy of the assembly (not the one in the GAC) and go
          from there.



          Mattias

          --
          Mattias Sjögren [MVP] mattias @ mvps.org
          http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
          Please reply only to the newsgroup.

          Comment

          Working...