none
Adding assemblies in the GAC RRS feed

  • Question

  • Hi,
     I added an assembly to the GAC using GACUTIL.EXE  then tried to add it to my toolbox by navigating to the GAC. This didn't work.
    I then navigated to the physical assembly file & noticed that it's path was stated as the Global Assembly Cache.
    I could load it from here.

    Am I correct in my understanding that it's in fact it's a two step process. i.e. Add the assembly to the tool box & register it in GAC?
    Also, is it ok then once it's registered to move/delete the physical file once it's been added?

    Why can you not load it into the toolbox directly from the GAC?

    Thanks very much  for your answers.
    @nt
    Thursday, July 10, 2008 7:04 AM

Answers

  • Yes, it is a two step process.  Reference assemblies are always stored as a separate copy.  If you right-click the Toolbox and select Choose Items, you'll see that all controls have a path that is not pointing to the GAC.  Usually c:\windows\microsoft.net\...  This is only relevant to you as a developer, the user will only ever use the assembly from the GAC.
    Hans Passant.
    • Marked as answer by A n t Friday, July 11, 2008 12:18 PM
    Thursday, July 10, 2008 1:00 PM
    Moderator

All replies

  • Yes, it is a two step process.  Reference assemblies are always stored as a separate copy.  If you right-click the Toolbox and select Choose Items, you'll see that all controls have a path that is not pointing to the GAC.  Usually c:\windows\microsoft.net\...  This is only relevant to you as a developer, the user will only ever use the assembly from the GAC.
    Hans Passant.
    • Marked as answer by A n t Friday, July 11, 2008 12:18 PM
    Thursday, July 10, 2008 1:00 PM
    Moderator
  • Hi Nobugs, I appreciate your time in stopping to answer this question.

    Two more queries:
     
    Is it safe to delete the physical assembly or move it once you've done both steps. I have done this & my design environment seems quite happy so far.

    Secondly, does the assembly get automatically included in the bin directory of the application or does the assembly have to be manually deployed to the users machine?

    Many thanks

    @nt
    Thursday, July 10, 2008 1:43 PM
  • Not sure if the toolbox manager makes a copy of the assembly.  I think it does, your test seems to bear this out.  There was a bug in the release version of VS2005 where a copy was made over and over again, leading to gigabyte size folders and very long startup times.  So, yes, probably.  No idea where it puts it.

    Whether or not you get a copy of the reference assembly in your bin folder depends on whether or not you installed the assembly in the GAC.   The IDE automatically sets Copy Local = true if it doesn't find the assembly in the GAC.  That doesn't mean you have to deploy the copy, you would if you decide not to install the assembly in the user's GAC.


    Hans Passant.
    • Proposed as answer by Mingzhi22 Thursday, July 17, 2008 8:18 AM
    Thursday, July 10, 2008 2:57 PM
    Moderator
  • Hans,

    Much appreciate your time taken to discuss this. I have a much better understanding of it now.

    Many thanks.

    @nt
    Friday, July 11, 2008 12:17 PM