locked
C# simple doubt RRS feed

  • Question

  • i have a dll which is registered in gac.

    And an exe, which is using this dll, this dll is also placed in the same folder where exe is there. And added this dll as reference which is available in the same folder.

    so which dll is referenced by exe during runtime, the one which is there in the local folder or the one which is there in gac?

     

    Tuesday, February 22, 2011 12:34 PM

Answers

  • @D.Sreedhar, you're actually incorrect. The CLR will first check the GAC for an exact version, if it can't find one it will start probing a list of known folders (including the application folder). The exact process is outlined here:

    http://msdn.microsoft.com/en-us/library/yx7xezcf.aspx


    Recipient of the Microsoft Community Contributor Award 2011.
    • Proposed as answer by Jesse HouwingMVP Tuesday, February 22, 2011 3:12 PM
    • Marked as answer by Cookie Luo Thursday, March 3, 2011 9:44 AM
    Tuesday, February 22, 2011 3:12 PM
  • Hi
      If you refer the dll has a strong name, then it will first check in te GAC, if failed to load, checks the appliation directory. If it is a partial reference, means only the assembly name, it will check only in the application directory.


    -- Thanks Ajith R MCTS-ASP.NET&Win Forms
    • Proposed as answer by D.Sreedhar Wednesday, February 23, 2011 6:33 AM
    • Marked as answer by Cookie Luo Thursday, March 3, 2011 9:43 AM
    Tuesday, February 22, 2011 5:59 PM

All replies

  • It uses the reference whatever you added.

     

     


    Knowledge is like light; It spreads only when you have clear and transparent mind.
    Tuesday, February 22, 2011 12:43 PM
  • @D.Sreedhar, you're actually incorrect. The CLR will first check the GAC for an exact version, if it can't find one it will start probing a list of known folders (including the application folder). The exact process is outlined here:

    http://msdn.microsoft.com/en-us/library/yx7xezcf.aspx


    Recipient of the Microsoft Community Contributor Award 2011.
    • Proposed as answer by Jesse HouwingMVP Tuesday, February 22, 2011 3:12 PM
    • Marked as answer by Cookie Luo Thursday, March 3, 2011 9:44 AM
    Tuesday, February 22, 2011 3:12 PM
  • If you have access to the exe source code, you can see in "References" which dll is referenced.
    Tuesday, February 22, 2011 5:48 PM
  • Hi
      If you refer the dll has a strong name, then it will first check in te GAC, if failed to load, checks the appliation directory. If it is a partial reference, means only the assembly name, it will check only in the application directory.


    -- Thanks Ajith R MCTS-ASP.NET&Win Forms
    • Proposed as answer by D.Sreedhar Wednesday, February 23, 2011 6:33 AM
    • Marked as answer by Cookie Luo Thursday, March 3, 2011 9:43 AM
    Tuesday, February 22, 2011 5:59 PM