18

I am a little confused about where .NET assemblies are physically located. Take good old LINQ. In my web.config file it says:

<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

This is the reference to LINQ. But where exactly is the DLL this refers to located? There isn't any path in the above and it's not in my bin folder.

I also have what I think is a third-party assembly reference:

<add assembly="MapInfo.CoreTypes, Version=4.0.0.483, Culture=neutral, PublicKeyToken=F548BCBA69D4B8DA" />

How can I tell where this is located on my machine if it's not in the bin folder?

Also, if a DLL file is in the bin directory, can I assume that it doesn't need to be referenced in web.config?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Petras
  • 4,686
  • 14
  • 57
  • 89

6 Answers6

15

I think they are located in the GAC, which is located in %WINDIR%\Assembly. More information is in Demystifying the .NET Global Assembly Cache (at The Code Project).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
John Boker
  • 82,559
  • 17
  • 97
  • 130
  • Yours is likely at URL `file:///C:/Windows/Assembly/GAC/` (wish I could force that to be a link) – John K Feb 08 '10 at 02:58
  • What about MapInfo.CoreTypes, if that is third party where would it be located? – Petras Feb 08 '10 at 03:04
  • if it's been registered with the gac, it's probably located there. is it not there? – John Boker Feb 08 '10 at 03:06
  • 1
    @Petra. They *might* be gac'd. They might simply be whereever you installed them. Personally, I wish the GAC didn't exist and instead forced the apps to have their own BIN directories. – NotMe Feb 08 '10 at 03:07
  • unless it's being added as a reference just using the dll, as in the example here http://testdrive.mapinfo.com/TechSupp/MIProd.nsf/8248bf2b72f6949585257125006b035a/220c3abad4cd681785256f890054e4fc?OpenDocument , in which case it's located under the program files somewhere. – John Boker Feb 08 '10 at 03:07
  • These reasons are precisely why you need use the Assembly Binding Log Viewer (see my answer). – Mike Post Feb 09 '10 at 06:40
9

Third-party assemblies might not be in the GAC, see MSDN article How the Runtime Locates Assemblies for the set of rules. Or, try the SysInternals FILEMON.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Chris O
  • 5,017
  • 3
  • 35
  • 42
6

Some of the .Net Assemblies are located in the installation folder of .Net

Such as

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0

Inside there are the assemblies sitting. In the .NETFramework one level up you would find the different versions of .NET and their corresponding assemblies.

diaz994
  • 354
  • 3
  • 13
  • 2
    No. These are the reference assemblies. They are skeleton assemblies, without actual implementation. – k29 Nov 08 '16 at 15:40
5

Assembly and Fusion path probing is pretty complicated. I will say that typically .NET will resolve an assembly from one of two places:

  1. Either it will find it in local directory, like the current directory, a bin subdirectory, or other place specified by the Fusion assembly-binding logic, or

  2. it will find it in the global GAC store, where assemblies can be registered and looked up by name, version, and a couple other attributes.

To address your specific question about the 'bin' directory, if you're using ASP.NET (which I assume from your reference to web.config), then yes, you don't need to include the path - ASP.NET will take care of whatever it needs to do in order to make .NET look for assemblies in the 'bin' directory.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Bruce
  • 8,202
  • 6
  • 37
  • 49
3

The short answer is: it depends on alot of things. The framework has its rules for how it loads assemblies. However, you can override this using the various config files (machine.config, etc). To find out where your assemblies actually live on a particular system, use the Assembly Binding Log Viewer. (It's part of the platform SDK. Just open up an SDK command shell and run fuslogvw.exe.)

Mike Post
  • 6,355
  • 3
  • 38
  • 48
3

An assembly can be found mostly in either of the following places:

  • GAC - C:\Windows\Assembly\GAC (Microsoft provided and by third-party in some cases)
  • Installation folder (most of the third-party controls)

You can get path and other information about an assembly by right clicking on the assembly in your project references and selecting Properties.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sharique
  • 4,199
  • 6
  • 36
  • 54