A lot has been written about this (challenging) topic; so I'll link to what I've found (and please add more links in the comments).
I've been using a https download-during-boot approach for ImageResizer, but that is slow, unreliable, and annoying. I tried to create an example of how to build the ideal native/managed hybrid project, failed, then started a project to try to hot-fix the problem at runtime, and hit another series of roadblocks.
I've identified a few invalid assumptions that seem responsible for the current state of things.
Some of these are somewhat comical considering how easy it is to parse binaries for the major platforms and determine runtime compatibility.
Removing these assumptions, what new requirements are we left with?
So, I guess
Conditions:
Given that a fallback mode (building from source) is likely popular, we want to make it easy to ensure that only 1 reference from a conditional set is chosen. We should probably group them within another element or provide an id that prevents duplicates.
Target strings need to be as generic as can be permitted based on their restrictions.
/ - root is AnyCPU
/32b/ - managed, assumes 32-bit pointer, otherwise portable
/64b/ - managed, assumes 64-bit pointer, otherwise portable
/x86/winish/ - 32-bit, requires windows APIs.
pointer size, architecutre, and endianess are combined into the first string. Pointer size and endianess are only included if the architecture string doesn't make them redundant. I.e, we would see /ARM-little/ and /ARM-big/, but not /x86-little/.
The approach is quite similar to the ref/lib/rid approach of NuGet 3 packages and runtime.json file. See this link - http://docs.nuget.org/Create/uwp-create.
We are in a process of thinking about a gen2 of this layout and hope to share the idea not that long out once we put some more time into it.
Is there a list of RIDs?
We are in a process of thinking about a gen2 of this layout and hope to share the idea not that long out once we put some more time into it.
Could this be documented prior to implementation, so there can be community feedback stage? The current design doesn't seem to take many of the points above into account.
RIDs are defined by the following nuget package - https://www.nuget.org/packages/Microsoft.NETCore.Platforms
And you can define your own as well.
Yes
I think it would be good for Paket to look at the runtime.json files in the nuget packages to get a list of additional transitive dependencies for each platform.
In this example:
http://blog.ctaggart.com/2015/10/minimal-coreclr-console-app.html
Paket could look at the System.Console's runtime.json to see that it depends on runtime.win7.System.Console.
{
"runtimes": {
"win7": {
"System.Console": {
"runtime.win7.System.Console": "4.0.0-beta-23409"
}
},
"unix": {
"System.Console": {
"runtime.unix.System.Console": "4.0.0-beta-23409"
}
}
}
}
we now have basic support for native dependencies
Is there any documentation on how to build NuGet packages to support native dependencies?
Most helpful comment
Is there any documentation on how to build NuGet packages to support native dependencies?