For the sake of scoping this document is going to focus on targeting .NET Standard and not .NET Core or .NET Framework, those can be considered more later.
Today if you target .NET Standard 2.0 you will get netstandard.dll which is where all the types are defined but you will also get a ton of facade/shim assemblies that allow folks to consume binaries compiled against other target frameworks. In particular we have a set of shims for .NET Framework (https://github.com/dotnet/standard/blob/master/netstandard/pkg/shims/netfx.shimlist.txt) and a set for older .NET Standard 1.x (https://github.com/dotnet/standard/blob/master/netstandard/pkg/shims/netstandard.shimlist.txt). 112 facades in total. That is a lot of assemblies to be passing around for not a lot of good reasons. Those 112 assemblies only contain the older assembly identity and a set of type-forwards so the types can unify with netstandard.dll. Passing around 112 assemblies as well as reading and parsing them over and over can add a significant amount of time to the build pipeline.
One potential alternative is to stop shipping these as IL assemblies and instead ship them in some manifest format and embed it directly into netstandard.dll. That would save on number of files passed around as well as size of data and avoid individual file loading and reading. This manifest would need to contain a list of assembly identities (i.e. name, version, key) as well as a list of type references that they type forward to netstandard.dll. These would be very similar in nature to our TypeForwardedFrom metadata we use for serialization.
In order to switch to such a model we would need to teach our tools (i.e. RAR, CSC, etc) how to find and resolve assembly and type references to those identities by reading the manifest instead of cracking open all the files.
TODO: List of tools that would need to be updated:
- We would need to teach the Reflection MetadataReader library how to understand this which would add support to tools like CSC.
- We would need to move tools like RAR to use the MetadataReader or update their usage of LMR to understand this new format