dolittle-obsolete / DotNET.Fundamentals

Reusable, fundamental abstractions and building blocks
http://www.dolittle.io
MIT License
4 stars 8 forks source link

Improve on Assembly loading to support finding the best matching assembly for the RID (Runtime Identifier) expected #243

Open einari opened 5 years ago

einari commented 5 years ago

In AssemblyContext we have our OnResolve() method, it delegates to a private method for getting a CompileLibrary to work with. This can come from either RuntimeLibraries on the DependencyContext or from the CompileLibraries. For a RuntimeLibrary, it has a RuntimeAssemblyGroups property we look into for getting the actual path to the runtime assembly to use. This is right now just assuming the first assembly - which could potentially be for the wrong target platform running.

The thing is that the runtime assemblies could be specific for the target platform, and not just Any platform. Which suggests that if the first assembly is a unix assembly, then this won't work on Windows for instance.

Read more here: https://github.com/dotnet/corefx/blob/master/pkg/Microsoft.NETCore.Platforms/readme.md

Here is the Runtime identifier catalog: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog

We should based on the current running operating system determine which runtime identifier is the appropriate and select it. This needs to consider the hierarchy and inheritance. Have a look at the runtime.json to get an idea.

image

This also applies to the Assets path being handed in as paths as well.

┆Issue is synchronized with this Asana task