I am studying about assemblies and confused on some points after searching I am asking question here. I read about assembly resolution that for strongly named assemblies the order of assembly resolution is to first check GAC then the root directory and then private probing.
Suppose I have a solution with multiple projects and within this there is a folder to place all the reference assemblies lets say log4net and in project where I need to use log4net assembly I add reference of log4net dll pointing to the folder within application solution directory where all referenced dlls have been placed. So why CLR check GAC and then root directory etc why not from the path mentioned while adding reference.
.net-assembly resolution
409 views Asked by AudioBubble At
1
I think you mean "in Visual Studio" when you say "add reference to this".
What will happen when you run the program on a machine where this path does not exist?
Btw. the "Add reference" in visual studio is only used at compile time. It will copy the referenced dll to the target folder.
Visual Studio creates a target folder (Standard bin\Debug or bin\Release) in the project folder and stores there all files (exe, dll, config) for deployment.
Installing DLLs into GAC has to be done manually and makes sense only if it is a DLL which is used by several applications and should be used carefully.
You could get strange and difficult to find errors when your application loads a dll from GAC and this dll has another version as expected by your application.