I am getting very confused between Namespaces and Assemblies. Are System.Data
and System.Web
Namespaces or Assemblies?
I have noticed these
Assembly is physical grouping of logical units, Namespace, logically groups classes.
Namespace can span multiple assembly
System.Data
is a namespace, System.Data.DLL
(the file) is an assembly.
A namespace is a logical grouping of types (mostly to avoid name collisions). An assembly can contain types in multiple namespaces (System.DLL
contains a few...), and a single namespace can be spread across assemblies (e.g. System.Threading
).
They are namespaces.Assemblies contains more than one namespace.For Example: System.dll
contains these namespaces (and more):
Also one namespace might contain nested namespaces.They are just logical names to organize the code.Just be aware, a DLL
files are assemblies that contains namespace(s).
GAC
is Global Assembly Cache. According to MSDN:
The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.
So commonly used assemblies stored in the GAC
and therefore you don't need to copy all assembly files to your project directory that you are referencing from your project.The assemblies stored in the GAC
are Strong-Named assemblies.Normally when you add a reference to an assembly from your project that is not Strong-Named
a copy of your .dll
file will be created on your bin\Debug
folder..If you wish you can make your assembly (class library project for example) Strong-Named.See: How to: Sign an Assembly with a Strong Name