Lessons in this course (11)
4. Assemblies, metadata, manifest, GAC, strong names and versioning
An assembly is the unit of deployment, versioning and security: a .dll or .exe containing:
| Part | Contains |
|---|---|
| PE header | Windows/OS executable format |
| CLR header | Runtime version, entry point, flags |
| Metadata | Every type, method, field, parameter, attribute and referenced member — what reflection and IntelliSense read |
| IL code | Method bodies |
| Manifest | Assembly identity (name, version, culture, public key token), list of files, referenced assemblies |
| Resources | Embedded files, localised strings |
Kinds: private assemblies (in the app folder — the norm today), shared assemblies in the GAC (Global Assembly Cache, .NET Framework only — C:\Windows\Microsoft.NET\assembly), satellite assemblies (localised resources, fr\MyApp.resources.dll).
Strong name = name + version + culture + public key token, signed with a key pair; required for the GAC in .NET Framework. Version format: major.minor.build.revision. Binding redirects in app.config/web.config solved "DLL hell" version conflicts in Framework; modern .NET resolves versions via NuGet and deps.json (no GAC).
<!-- .NET Framework web.config binding redirect -->
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>AppDomain vs AssemblyLoadContext: .NET Framework used AppDomains to isolate and unload code inside one process (IIS used one per web app). .NET Core removed multiple AppDomains; use AssemblyLoadContext (collectible contexts can be unloaded — plugins) or separate processes/containers for isolation.